
ADO, SQL Server Updating Recordset using 2 Tables
I have problem by updating recordset using more then one table in the
recordset. There is no problem by updating fields from the first table. I
can set the fields from the second table but by executing the Update method
i have error message :
Run-time Error '-2147467259 (80004005)
[Microsoft][ODBC SQL Server Driver][SQL Server] Invalid Column Name
'Stock'
Is there an ADO bug or am I doing something wrong. I try it allready with
ADO 2.5 and had the same problem.
My SQL statment :
SQL = SELECT * FROM Items INNER JOIN Stock on Items.Plu_Code =
Stock.Plu_Code WHERE Descript LIKE 'G%' AND Branch_02 <> 0 AND
Stock.Betrieb=2
I open it with Command
mRS.Open SQL,mConnection,adOpenKeySet,adLockOptimistic,adCmdText
I Open Connection with following command
sConnetstring ="DRIVER=SQL Server;SERVER=NT5SRV-MK;UID=sa;PWD=;APP=Visual
Basic;WSID=NTWS-DAMIR;DATABASE=neXStore;TranslationName=Yes"
mConnection.Open sConnectString
To update recordset I am using the following code
mRS("Plu_Code") = Product.PluCode 'Field from ItemsTable
mRS("Descript") = Product.Descript 'Field from Items Table
mRS("CostPrice_Aktuell") 'Field from Items Table
.
.
.
mRS("Stock") = Product.Stock 'Field from Stock Table
mRS.Update ' Here I have
Error I mentioned before