c# - Is it possible to lock an Access table? -



c# - Is it possible to lock an Access table? -

as title suggests, have access 97 db , know if it's possible lock table after insert unlock immediately?

i need add together record , autonumber of added record (by ordering desc). problem between insert , retrieve there can add together externally (which wrong autonumber).

unfortunately, cannot utilize select @@identity not supported access 97 database file (already tried , tested, ref: here).

i have access 97 db , know if it's possible lock table after insert unlock immediately?

not really. however, although cannot utilize select @@identity access 97 database file can still utilize dao.recordset add together record:

class="lang-csharp prettyprint-override">// code requires next com reference in project: // // microsoft office 14.0 access database engine object library // // , declaration // // using microsoft.office.interop.access.dao; // // @ top of class file var dbe = new dbengine(); database db = dbe.opendatabase(@"c:\users\public\test\a97_files\a97table1 - copy.mdb"); recordset rst = db.openrecordset("select * table1", recordsettypeenum.dbopendynaset); rst.addnew(); // new autonumber created addnew() called int newid = rst.fields["id"].value; rst.fields["textcol"].value = "record added via dao recordset."; rst.update(); console.writeline("row added id = {0}", newid); rst.close(); db.close();

c# ms-access oledb ado

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -