Great Ideas. Always Flowing.

We are not happy until you are happy. Client satisfaction guaranteed. Whatever your needs and requirements, we have the skills and resources for the job!

Quick login...


Or... now make it easy with Facebook Integration
Connect via Facebook



Top Sellers

Frustrated over the lack of customization for your user's registration fields? Dynamically setup your DNN Portal with custom registration fields, layout, questions, and other core integration options......

Ultra Video Gallery is a brother product of Ultra Media Gallery, UVG allows you to upload videos in various format and automatically encode them to flv or H264 format, you also can add videos from internet or record live videos from your webcam.

Build high performance, completely customizable data-entry forms and views driven by your DNN and external databases. New built-in tools make it a snap to quickly create data entry forms, data views, and even database tables. Plus, add your own HTML, CSS, Javascript, SQL commands, stored procedures,

The most advanced DotNetNuke shopping cart on the planet. Easy to use e-Commerce, Secure Shopping Cart Software and SEO friendly. B2C / B2B Ecommerce Sites.

One stop solution for events calendar and events registration! FREE DOWNLOAD is available now!

How do I use current user ID or name in SQL WHERE clause?
Last Post 10-19-2009 02:40 PM by Chad Nash. 6 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Dick MallardUser is Offline
Posts:4
Avatar

--
09-24-2009 01:19 PM

    I have a simple SQL query that returns a value in Host/SQL but none when I use a Token in Tailored Text SQL. How is this intended to work? I cannot find an actual example in the docs for Tailored Text, the example uses a query string.

    Token for is $(CompanyName)

    Token Key
    SELECT Contacts.[CompanyName]

    FROM {objectQualifier}xxxxx_ContactDetail As Contacts
    WHERE Contacts.[UserName] = $(UserName)

    I've tried variations on the token as variable syntax such as [UserName], '$(UserName)'
    Also tried to match on UserID

     

    Dick MallardUser is Offline
    Posts:4
    Avatar

    --
    09-24-2009 01:34 PM

    This is with Tailored HTML v 2.10.21 on DNN 5.1.1

    David ToUser is Offline
    river guide
    river guide
    Posts:2719
    Avatar

    --
    09-24-2009 01:39 PM
    Try using the token $(UserID). -- David
    Dick MallardUser is Offline
    Posts:4
    Avatar

    --
    09-24-2009 02:03 PM

    David thanks for your response...

    I tried $(UserID) in my query and it did not work...

    But

    SELECT Username
    FROM {objectQualifier}Users
    WHERE UserID = $(UserID)

    works fine.

    The example query in my original post does not show I have to use 3 tables to get user's Company Name to display from UserID

    table1 CompanyDetails contains Company Name, CompanyID
    table2 ContactDetails contains Username, CompanyID
    table3 Users contains Username, UserID

    Is there some limit to the query that can be used? 
    I've read suggestions from Chad to use SProcs for this but don't know how. Is there an example for using stored procedures in the module's SQL token key?

    David ToUser is Offline
    river guide
    river guide
    Posts:2719
    Avatar

    --
    09-28-2009 07:13 AM
    Hi, try this SQL statement:

    select CompanyDetails.[Company Name] as defaultvalue from CompanyDetails inner join ContactDetails on CompanyDetails.CompanyID = ContactDetails.CompanyID inner join {objectQualifier}Users on ContactDetails.Username = {objectQualifier}Users.Username where {objectQualifier}Users.UserID = '$(UserID)'

    -- see if this works for you. -- David
    Dick MallardUser is Offline
    Posts:4
    Avatar

    --
    10-09-2009 12:04 PM

    David,

    Your suggestion did not work but showed me some things that when tweaked gave me the result I was looking for.

    Here is what finally worked:
    select {objectQualifier}CompanyDetail.[CompanyName] as Company from {objectQualifier}CompanyDetail inner join {objectQualifier}ContactDetail on {objectQualifier}CompanyDetail.[CompanyID] = {objectQualifier}ContactDetail.[CompanyID] inner join {objectQualifier}Users on {objectQualifier}ContactDetail.[Username] = {objectQualifier}Users.Username where {objectQualifier}Users.UserID = '$(UserID)'

    Possibly not the most concise, but I've got what I need!!!

    Thanks again

    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    10-19-2009 02:40 PM
    Dick,

    Thanks for posting the update, I am sure it will be helpful for other users!

    -Chad
    You are not authorized to post a reply.


     
     

    Join our mailing list...

    Get current news and events the easy way
     
     
       
    Subscribe Me

    Recent Blogs...

     
    Copyright 2005 - 2011 by Data Springs, Inc.
     
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi