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 Validation example
Last Post 05-07-2008 11:13 AM by Chad Nash. 3 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
James SpechtUser is Offline
skipping stones
skipping stones
Posts:15
Avatar

--
05-01-2008 05:51 AM

    Is there an example of the stored procedure to perform a question validation.  Specifically, I need to make sure that the value input exists in column A, and the value in Column B is equal to the word 'valid'.  Any help would be appreciated.

     

     

    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    05-01-2008 11:15 AM

    Hi. Well SQL Validation does allow you to pull in tokens (fields) but there needs to be only one column returned within the SQL and this column needs to be called 'IsValid'. If it returns false or 0 then it will return the error message and not pass, if it returns anything else it will return true. So... Not sure specifically your instance but are you pulling information from the database table? Here is an example:

    Lets let the user enter a username, we will check the database and if that user exists it will return the UserID, if it doesn't it will return 0.

    Select count(*) from Users where UserName = '$(UserName)'

    This assumes that a short field name of UserName exists on the form. The SQL will check the database and will return either a 1 (user exists) or 0 (user does not exist).

    For all SQL VAlidation you should always use stored procedures though. You will want to pass the field tokens to a stored procedure and have it handle the validation. Basically this allows you to use safe (avoid SQL Injection) methods for SQL Validation but it also allows you to put more logic within SQL validation. You could technically have all types of logic within the stored procedure, maybe if / else statements, select case statements, or other logic and then simply return 'True' or 'False' to one column called IsValid. We will try and post more real life scenarios with demonstrations down the road. SQL Validation is new for 2.6 and we will actually be changing it down the road to be on each field level (so you can run multiple validation instead of a single validation for the entire form).

    -Chad

    James SpechtUser is Offline
    skipping stones
    skipping stones
    Posts:15
    Avatar

    --
    05-02-2008 09:13 AM
    Thanks for the explain Chad. That is close to what I want to do. Having not worked much with stored procedures, could you provide the text of the stored procedure, as well as what would actually go in the module? Thanks
    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    05-07-2008 11:13 AM
    I wanted to add to this to be more descriptive regarding the SQL statements for validation... So it should return one column called 'IsValid' but in my example above I didn't do that.

    So it should be:

    Select count(*) from Users AS [IsValid] where UserName = '$(UserName)'

    So in this case if the user entered 'Admin' for username field it would return true, but if they entered 'somethingelse' that wasn't in the users table it would return a column called IsValid with a value of 0 and therefore not return 0 and fire off the validation message.

    -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