Connecting Tech Pros Worldwide Help | Site Map

updating a database

Newbie
 
Join Date: Aug 2009
Posts: 1
#1: Aug 14 '09
Hello Everyone

I'm searching a database to find a value in the database and once the value is found, it should update the row corresponding with the productid, which is the PK in which I'm using to search the database.
But I'm getting an error saying wrong number of arguments or invalid property assignment. My code looks like this:
Do While Not rs.EOF

If productid = rs!product_id Then
Set updatedb = New ADODB.Connection
updatedb.Open "DSN=waterdb;Password=andile;User ID=eco;Data Source=waterdb"
Set rs1 = New ADODB.Recordset
rs1.Open "Select product_id,qty,stock_date,trans_type,qtydb from stock", "update stock set product_id=productid", "update stock set qty=qty", "update stock set stock_date=date", "update stock set trans_type=trans_type", "update stock set qtydb=qtydb"
With Adodc1
.Recordset.Update
.Recordset.Fields("product_id") = productid
.Recordset.Fields("qty") = qty
.Recordset.Fields("stock_date") = dop
.Recordset.Fields("trans_type") = "trans_type"
.Recordset.Fields("qtydb") = qtydb

End With

Else: MsgBox ("invalid product id")
End If

The error is at rs1.open
PLEASE HELP!!!!!
Reply