-
INSERT INTO Query
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
-
Hi
Please check the constraints once again and check the autonumber column(Primary Key) working properly!!
thanks
Murali
-
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.
-
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.
-
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