Skip to main content
Known Participant
November 29, 2006
Question

Insert Procedure

  • November 29, 2006
  • 1 reply
  • 274 views
I am trying to get an insert procedure to add a date and also a product number to my database.

i tried using...
INSERT INTO InvReview (Date, ProductNum)
VALUES (ReviewDate, ReviewStockNum)
with the variables
ReviewDate (Date())
ReviewStockNum (InvReview.Fields.Item("ProductNum").Value)

the date will work ok but i cannot seem to figure out how to get the ProductNum from my recordset into the database.
how can i get a dynamic field into my stored procedure
This topic has been closed for replies.

1 reply

Inspiring
December 1, 2006
This is untested,

dim varProdNum

varProdNum = InvReview.Fields.Item("ProductNum").Value

sql = "INSERT INTO InvReview (Date,ProductNUM)"
sql = sql & " VALUES "
sql = sql & "('" & Date() & "'," & varProdNum & ")"

'execute the insert to SQL Server
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_YourStringHere_STRING
MM_editCmd.CommandText = sql
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

Drew



"acidrain9" <webforumsuser@macromedia.com> wrote in message
news:ekkumv$kh3$1@forums.macromedia.com...
>I am trying to get an insert procedure to add a date and also a product
>number
> to my database.
>
> i tried using...
> INSERT INTO InvReview (Date, ProductNum)
> VALUES (ReviewDate, ReviewStockNum)
> with the variables
> ReviewDate (Date())
> ReviewStockNum (InvReview.Fields.Item("ProductNum").Value)
>
> the date will work ok but i cannot seem to figure out how to get the
> ProductNum from my recordset into the database.
> how can i get a dynamic field into my stored procedure
>