For DB experts only!
-
Hi This is not a regular problem but still any one who know the answer is bigger then life. Let say we have an access database file (mdb) with one table that called tblRecID with 2 fields: "RecID" & "Info". "RecID" is auto number + Primery key + Index. "Info" is simple text. If we saved 2 records to this table then the next "RecID" will be 3. Now let's delete the 2 records and the table is now empty again. How can you get the current "RecID" that need to be 2 (for now) by code (maybe DataTable object) ? Any one?
-
Hi This is not a regular problem but still any one who know the answer is bigger then life. Let say we have an access database file (mdb) with one table that called tblRecID with 2 fields: "RecID" & "Info". "RecID" is auto number + Primery key + Index. "Info" is simple text. If we saved 2 records to this table then the next "RecID" will be 3. Now let's delete the 2 records and the table is now empty again. How can you get the current "RecID" that need to be 2 (for now) by code (maybe DataTable object) ? Any one?
lee1212 wrote: How can you get the current "RecID" that need to be 2 (for now) by code (maybe DataTable object) ? I'm with you right up until this sentence. Please can you clarify.
-
Hi This is not a regular problem but still any one who know the answer is bigger then life. Let say we have an access database file (mdb) with one table that called tblRecID with 2 fields: "RecID" & "Info". "RecID" is auto number + Primery key + Index. "Info" is simple text. If we saved 2 records to this table then the next "RecID" will be 3. Now let's delete the 2 records and the table is now empty again. How can you get the current "RecID" that need to be 2 (for now) by code (maybe DataTable object) ? Any one?
There is a SQL statement for setting "IDENTITY_INSERT" on or off. With it on, you can insert any legimate value you desire (it can't be a duplicate to what is there). When you are done, turn it back off. syntax SET IDENTITY_INSERT [ database. [ owner. ] ] { table } { ON | OFF } but you need either "owner" or "dba" the rights to the database.