Click to See Complete Forum and Search --> : INSERT INTO Query
Limor Janah
March 31st, 2003, 12:33 AM
Hi
I am using the query:
INSERT INTO Brands ([BName],[BDescription],[PicturePath]) VALUES ('mm','mm','mm')
by using the "ExecuteNonQuery" of "OleDbCommand".
and i am getting the error:
"Operation must use an updateable query. "
I tried to execute the same query directly from the
mdb file and it's working.
any ideas?
Thanks
Limor
chmurali
April 3rd, 2003, 03:02 AM
Hi
Please check the constraints once again and check the autonumber column(Primary Key) working properly!!
thanks
Murali
Dreamon
April 4th, 2003, 01:25 PM
I don't think you can use ExecuteNonQuery when executing queries like that (hence the name ExecuteNONQuery). I think it's for executing stored procedures. Use ExecuteScalar instead.
Hope this helps.
chmurali
April 5th, 2003, 02:56 AM
ExecuteScalar will return only firstcolumn of the firstrow in the resultset. ExecuteNonQuery returns the count of records affected.
ExecuteNonQuery is the correct one in this case but I think there is something wrong in the database side or at the code part. Paste the Insert code part over here.
Limor Janah
April 6th, 2003, 06:38 AM
INSERT INTO Brands ([BName],[BDescription],[PicturePath]) " & _
"VALUES ('nameStr','decStr','pathStr')
i took this query and run it from the access file and it's working.
it gives me the same error when i use the UPDATE query
i am using this syntax all the time.
this is the first time i get this error
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.