Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Insert data with Sproc.


Message #1 by "Christian Dygaard" <cdygaard@m...> on Wed, 16 Oct 2002 13:19:23 +0200
Hi.

How do you insert some data in a SQL Database using a stored procedure?
Right now I've made the stored procedure and it's working fine, and I've
tried to use the command object to insert the data. The problem is  writing
the correct input for the objCmd methods. I've tried this:

Set objCmd = Server.Createobject("ADODB.Command")
   Set objCmd.ActiveConnection = objConn
   objCmd.CommandText = dbo.up_parmins_ucsigncom('" & strDate & "', '" & _
   strCompanyName & "', '" & strFirstname & "', '" & strLastname & "', '" &
_
   strEmail & "', '" & nvcCCNumber & "', '" & intExpMonth & "', '" & _
   intExpYear & "', '" & strDomainName & "', '" & intCCType & "'" & _
   ", '" & strLetterString & "')
   objCmd.CommandType = adCmdStoredProc
   objCmd.Execute

But I get the error message: syntax error, line 227, which is where it says
objCmd.CommandText.

How is this done properly?

Message #2 by "Gerhard Wentink" <gerhard@d...> on Wed, 16 Oct 2002 15:13:09 +0200
The Commandtext is a string, so you have to place it between quotes.

Regards,

Gerhard Wentink

>-----Original Message-----
>From: Christian Dygaard [mailto:cdygaard@m...] 
>Sent: Wednesday, October 16, 2002 1:19 PM
>To: ASP Databases
>Subject: [asp_databases] Insert data with Sproc.
>
>
>Hi.
>
>How do you insert some data in a SQL Database using a stored procedure?
>Right now I've made the stored procedure and it's working 
>fine, and I've
>tried to use the command object to insert the data. The 
>problem is  writing
>the correct input for the objCmd methods. I've tried this:
>
>Set objCmd = Server.Createobject("ADODB.Command")
>   Set objCmd.ActiveConnection = objConn
>   objCmd.CommandText = dbo.up_parmins_ucsigncom('" & strDate 
>& "', '" & _
>   strCompanyName & "', '" & strFirstname & "', '" & 
>strLastname & "', '" &
>_
>   strEmail & "', '" & nvcCCNumber & "', '" & intExpMonth & "', '" & _
>   intExpYear & "', '" & strDomainName & "', '" & intCCType & "'" & _
>   ", '" & strLetterString & "')
>   objCmd.CommandType = adCmdStoredProc
>   objCmd.Execute
>
>But I get the error message: syntax error, line 227, which is 
>where it says
>objCmd.CommandText.
>
>How is this done properly?
>
>
>


  Return to Index