Stored procedures ?!?!?!?

Results 1 to 3 of 3

Thread: Stored procedures ?!?!?!?

  1. #1
    Bob Geldof Guest

    Default Stored procedures ?!?!?!?

    Hi iam new to stored procedures... <BR><BR>I would like to insert alot of values in to a database and then return the ID och the just inserted record... I have read som FAQ´s and come up with the following soultion. AND IT WORKS... <BR><BR>But the problem is that in this code/exampel i have to code lots of statments if i would like to insert all those values i would like to post. IS there a way to save redundent code here ? <BR><BR>&#039;************************************ ******&#039; <BR>&#039;*** Declare variables ***&#039; <BR>&#039;**************************************** **&#039; <BR><BR>dim dataConn, adocmd, IsValid <BR><BR>test = "This is a test" <BR><BR>set dataConn = Server.CreateObject("ADODB.Connection") <BR>dataConn.Open "DSN=test" &#039;make connection <BR><BR><BR>&#039;******************************** **********&#039; <BR>&#039;*** EXECUTITON ***&#039; <BR>&#039;**************************************** **&#039; <BR><BR>Set adocmd = Server.CreateObject("ADODB.Command") <BR>adocmd.CommandText = "sp_test" <BR>adocmd.ActiveConnection = dataConn <BR>adocmd.CommandType = adCmdStoredProc <BR><BR>adocmd.Parameters.Append adocmd.CreateParameter("ID", adInteger, adParamReturnValue, 4) <BR><BR>&#039; THIS IS WHAT I MEAN, DO i HAVE TO REPEAT THIS LINE FOR EVERY SINGEL VALUE I WOULD LIKE TO INSERT? <BR><BR>&#039; say that i want to post the variable test1 to 20 <BR>adocmd.Parameters.Append adocmd.CreateParameter("test", <BR>adVarChar, adParamInput, 50, test) <BR><BR><BR>adocmd.Execute <BR><BR>testID = adocmd.Parameters("ID").Value <BR>test = adocmd.Parameters("test").Value <BR><BR>Response.write testID <BR>Response.write test <BR><BR><BR>Hope you understand my question =D <BR><BR>TNX

  2. #2
    Join Date
    Dec 1969

    Default RE: Stored procedures ?!?!?!?

    What happenned when you tried it?<BR><BR>You didn&#039;t?<BR><BR>What a surprise!!

  3. #3
    Bob Geldof Guest

    Default RE: Stored procedures ?!?!?!?

    Thanx alot!!!!! your briliant awnser realy helped me out!

Posting Permissions

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