Stored Procedure for form results
Last Post 08-28-2011 07:14 PM by sentient. 4 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
sentientUser is Offline
river guide
river guide
Posts:127
Avatar

--
12-05-2010 06:31 PM
    Hi I want to use DR and DF for a multipage order system but dont want to bloat the messy User Profile table with a bunch of order fields.

    I know how to write a standard INSERT query for a completion event but would rather have this as a Stored Procedure. Im not sure on how to make this with the $(xxx) tokens that the shortnames in the form use.

    Do you have an example on a very simple SP that references the UserID as a foreign key and UPDATES/INSERTS field data into a flat table? Even if its just 1 or 2 example fields, I can work from that.
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    12-06-2010 07:48 AM
    Hello Sentient,

    Yes you can learn on how to create and use flat tables from Demonstration 31:

    http://www.datasprings.com/formdemos

    You will catch on quickly from the first part of three parts of the demonstration.

    If you have any questions please let me know.

    Thanks,

    Ryan
    sentientUser is Offline
    river guide
    river guide
    Posts:127
    Avatar

    --
    12-06-2010 12:10 PM
    Thanks, That has the INSERT details but Im looking for a Stored Procedure that uses variables populated by tokens
    So the @Something = $(Something)

    How can I push the shortfield to the Stored Procedure? It says that we should be using this to prevent Injection.

    Thanks
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    12-07-2010 01:03 PM
    Hello Sentient,

    To push the $(token) over to the stored procedure be sure to use tick marks since it will most likely be a string value. Numbers, letter, or symbols can be considered strings.

    So the format/syntax would look like this:

    exec storedProcedureName '$(token1)', '$(token2)'

    Now here's what your stored procedure could look like

    CREATE PROCEDURE storedProcedureName(
    @tokenOne nvarchar(200) NOT NULL,
    @tokenTwo nvarchar(200) NOT NULL
    )

    AS

    BEGIN

    INSERT INTO yourTable WHERE yourColumn1 = @tokenOne AND yourColumn2 = @tokenTwo

    END

    If you have any questions please let me know.

    Thanks,

    Ryan

    sentientUser is Offline
    river guide
    river guide
    Posts:127
    Avatar

    --
    08-28-2011 07:14 PM
    Perfect answer - sorry the feedback was late


    ---
  • 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