+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: best way to bind values to sql statement?

  1. #1
    Contracted Slave Centurion is on a distinguished road Centurion's Avatar
    Join Date
    Dec 2008
    Posts
    533
    Rep Power
    4

    best way to bind values to sql statement?

    Hi,

    I want to bind values to sql statement.

    Example:

    [CustomerID*], [RequestID*], [ProblemDescription]


    the first text box needs to have the value "1" bound to it as well as the description. and also the session variable for the Customer.

    i have loads of request text boxes and drop downs, so i kinda need to know how i would do this on a large scale..

    hope you can help..


  2. #2
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    I'm not sure I entirely understand what you mean. Do you have any code to start from?

    Could you maybe give an example of what you want the end result to look like?

  3. #3
    Contracted Slave Centurion is on a distinguished road Centurion's Avatar
    Join Date
    Dec 2008
    Posts
    533
    Rep Power
    4

    Quote Originally Posted by richyrich View Post
    I'm not sure I entirely understand what you mean. Do you have any code to start from?

    Could you maybe give an example of what you want the end result to look like?
    1) user logs in,

    2) session variable is taken to the form,

    3) in order to insert data, the sql statement needs to have customerID, requestID, and problemDescription added.

    but because i have 10 different questions for the customer, i want to bind the pre-determined requestID's and session variables to each of the requests.

  4. #4
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    You mean you want to include the customerID session variable in your SQL statement as one of the values?

    Code:
    strsql = "INSERT INTO tbl(customerID) VALUES(" & request.session("customerID") & ")"
    

  5. #5
    Contracted Slave Centurion is on a distinguished road Centurion's Avatar
    Join Date
    Dec 2008
    Posts
    533
    Rep Power
    4

    Quote Originally Posted by richyrich View Post
    You mean you want to include the customerID session variable in your SQL statement as one of the values?

    Code:
    strsql = "INSERT INTO tbl(customerID) VALUES(" & request.session("customerID") & ")"
    
    yes, as well as the RequestID.. for example "1" and as well as the description..

  6. #6
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Code:
    strsql = "INSERT INTO tbl(customerID, RequestID, ProblemDescription) VALUES(" & request.session("customerID") & ", " & request.session("requestID") & ", " & "'" & request.session("problemDescription") & "')"
    
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  7. #7
    Contracted Slave Centurion is on a distinguished road Centurion's Avatar
    Join Date
    Dec 2008
    Posts
    533
    Rep Power
    4

    Quote Originally Posted by jmurrayhead View Post
    Code:
    strsql = "INSERT INTO tbl(customerID, RequestID, ProblemDescription) VALUES(" & request.session("customerID") & ", " & request.session("requestID") & ", " & "'" & request.session("problemDescription") & "')"
    
    cheers for that.. i have like 10 different text boxes, so im guessin i will have different session variables..

    wont that make the SQL statement massive....

  8. #8
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Not sure you really need to be using sessions for everything. The sessions would be for customerID...something that will stay the same through the session. The user's responses to the questions would be coming from the form fields, so you would use Request.Form("fieldname") instead of session.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  9. #9
    Contracted Slave Centurion is on a distinguished road Centurion's Avatar
    Join Date
    Dec 2008
    Posts
    533
    Rep Power
    4

    Quote Originally Posted by jmurrayhead View Post
    Not sure you really need to be using sessions for everything. The sessions would be for customerID...something that will stay the same through the session. The user's responses to the questions would be coming from the form fields, so you would use Request.Form("fieldname") instead of session.
    but for each question i have to attach the session and the requestID that means each question will have 3 sessions. so if i have 8 questions. that means i have to bind the 3 things together rite?

  10. #10
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    I guess because I don't really understand what you're doing it's hard to answer that. If CustomerID and RequestID don't change, then yes, using a Session would be appropriate. Otherwise get the values you need via Request.Form.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. Multiple queries in one statement?
    By bryceowen in forum SQL Development
    Replies: 8
    Last Post: March 26th, 2009, 04:11 PM
  2. loop update statement
    By peebman2000 in forum SQL Development
    Replies: 2
    Last Post: August 7th, 2008, 11:04 AM
  3. retrieve values
    By todd2006 in forum SQL Development
    Replies: 5
    Last Post: June 19th, 2008, 02:46 PM
  4. iif statement
    By Barkol in forum Microsoft Access
    Replies: 4
    Last Post: June 6th, 2008, 12:12 AM
  5. If statement stored procedure
    By peebman2000 in forum SQL Development
    Replies: 32
    Last Post: May 23rd, 2008, 04:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO