0
Answer

OleDB Concurrency Error

Ask a question
haluk darbag

haluk darbag

18y
1.7k
1
Hi, I'm coding a WFA for some cheap people who want to use Access 2002 as a DB as they already have a licenced Office 2002. Everything is set in the application except updating records. I let them update from a DataGrid, but it throws a Concurrency Exception, which I am guessing is due to a type-mismatch. In VS 2005, the DBType of the primary key field shows as Object when I debug, and I can not find a matching OleDBType to add to the parameter. Here's the part of the code: string updateQuery = "UPDATE product SET [no] = @no, maincat = @maincat, name = @name, artist = @artist, cover = @cover," + " genre = @genre, sub = @sub, dub = @dub, disc = @disc, extra = @extra, amount= @amount WHERE id = @id"; tb_Adapter.UpdateCommand = new OleDbCommand(updateQuery, tb_Connection); gridParam = tb_Adapter.UpdateCommand.Parameters.Add("@id", OleDbType.Numeric); gridParam.SourceColumn = "id"; gridParam.SourceVersion = DataRowVersion.Current; id is the primary key. So far I have tried Integer, Numeric, ShortInt, Unsigned Int. None of them work. If anyone can tell me the type of AutoNumber in terms of OleDBTypes in 2005, it'd be greatly appreciated.