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!

SQL Query Parameters
Last Post 08-11-2007 08:46 AM by Antony Corbett. 7 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Ben FloydUser is Offline
new to the springs
new to the springs
Posts:2
Avatar

--
07-10-2007 06:14 AM

    Is there a way to use session variables in a SQL Driven Option? For example:

    SELECT CourseID as QuestionOptionValue, CourseName as QuestionOption FROM StudentCourses WHERE UserID=@UserID AND Term=@Term

    The UserID would come from DNN default values or from a session variable, and the Term comes from the Session variables. If this is not possible, would it be difficult to modify the code to do so?

    Thanks,

    Ben

    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    07-11-2007 06:26 AM
    Ben,

    Hi. There are many default parameters/tokens you can use within the queries. For the userID you would use $(UserID), for the session variables I believe you would need to make the field a hidden field. For example create a hidden field called My Session with a short field name of MySession. Under Advanced Settings select to retrieve values from a session variable. Then... Within the query you should be able to pull it in as $(MySession). This should do it, just make sure that you also put the hidden field with a sort order that is smaller than the field you are using the query with. This should do it, if not I will review the code and see if something needs to be added to make this happen, this for sure should be a feature to implement.

    -Chad
    Eric HelinUser is Offline
    new to the springs
    new to the springs
    Posts:2
    Avatar

    --
    07-11-2007 10:16 AM

    Hi Chad:

    I work with Ben and I am having some trouble getting the $(UserId) to work...specifically, I am using this SQL in the question options section (w/Sql Driven Options selected) to populate options:

    SELECT DisplayName AS QuestionOption, DisplayName AS QuestionValue FROM Cleopatra_Courses WHERE UserID = $(UserID)

    The query works w/o the where clause, but when I add it...it doesn't work.  From your earlier post, it was my understanding that to get the user id of the person entering page, we filter on $(UserID).

    What am I missing?

    Thanks!

    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    07-11-2007 11:40 AM
    Trying adding ' before and after the token, also make sure the UserID is signed in. You should be able to test the query by using your query and replacing the token with a number.

    Example:
    SELECT DisplayName AS QuestionOption, DisplayName AS QuestionValue FROM Cleopatra_Courses WHERE UserID = 1
    OR
    SELECT DisplayName AS QuestionOption, DisplayName AS QuestionValue FROM Cleopatra_Courses WHERE UserID = '1'

    You probably need to add the ' marks, this is often missed and needed depending on your database.

    -Chad





    Fred Rules the universeUser is Offline
    new to the springs
    new to the springs
    Posts:2
    Avatar

    --
    07-11-2007 01:13 PM

    Hi Chad:

    Thanks for the speedy response!

    I tried that...specifically:

    SELECT DisplayName AS QuestionOption, DisplayName AS QuestionValue FROM Cleopatra_Courses WHERE UserID = '$(UserID)'

    Nothing came up...its my understanding that $UserID maps to the dot net nuke user information object (i.e. attached to the user who just opened this page)? 

    Or do we need to create a text box (hidden) to capture this value (i.e. we did this with the username value in the "Advanced Field Options" under the sql driver option controls and the user name appeared...but we couldn't get the sql statement to recognize this value)?

    Thanks!

     

    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    07-11-2007 01:34 PM
    Hi. I think I see the issue. It appears that the SQL is replacing the $(UserID) for 'SQL Events' but not when using the SQL for dropdownlists. I will see that this gets corrected ASAP and get an incremental patch out to you. So the query is probably not the issue at this point, you can temporarily change the query to pull in a static UserID to make sure everything else is working.

    -Chad
    Fred Rules the universeUser is Offline
    new to the springs
    new to the springs
    Posts:2
    Avatar

    --
    07-11-2007 01:37 PM

    Will do and thanks!

    Antony CorbettUser is Offline
    new to the springs
    new to the springs
    Posts:2
    Avatar

    --
    08-11-2007 08:46 AM

    I also need the ability to specify parameterized SQL in SQL Driven options. Please could I receive the patch?

    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