Domanda

I'm trying make a code for vb.net 2008 + msaccess 2003 to check if there is a row in a specific position between 2 rows, to be used on inserting data, which the previous data was deleted. (sorry for my bad english)

for example: there are data in rows 0, 1, 2, 3, 4 and 5. if i were to delete row 2 now, and add data later to that same position so that the position 2 wouldn't be blank. (because i use maxrow count for auto numbering)

refer to this statement:

If ds.Tables("MovieList").Rows(row) exist then
È stato utile?

Soluzione

The Simple answer is no because of the way all relational databases work. Once data is deleted the empty space in the data files are not reused until you do a compact / repair in ms access. Databases like sequel server do this compaction or space recovery in the background while MS Access it must be done manually or set on a timer with vb code to perform the compact / repair.

However if you trying to recover a number in a auto increment field that was deleted; that is a different question all together.

If you are simply trying to organize a list of items there are much better ways to do so than using the auto increment field.

Maybe re-ask the question on how to sort items in a specific way.

Altri suggerimenti

Try this;

If Not String.IsNullOrEmpty(ds.Tables("MovieList").Rows(row).Item(1)) Then
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top