Click to See Complete Forum and Search --> : [RESOLVED] gaps in identity value


lucia
November 13th, 2006, 11:58 AM
I am using SQL server 2000 database and VB6.

I have a table(test_1) with 1 identity column TestId. Datatype is smallint.

I have some missing Ids in the column and try to find them. I have searched web and found some sample codes. But they use
'Declare @*** int'. I can't use it in vb6. I wonder what they are and how I use it in Vb6?

Thanks in advance.

cjard
November 14th, 2006, 11:21 AM
Forget that in vb6, it's going to be easier to do this:


SELECT ident_field FROM table ORDER BY ident_field



then in the code:


'put some code in ehre to get a ado recordset
Dim i as Integer = WHATEVER_IDENT_STARTS_AT

While Not adoRS.EOF
While adoRS!ident_field <> i
MsgBox(i & " is not used")
i = i + 1
Wend
i = i + 1
adoRS.MoveNext
Wend

lucia
November 17th, 2006, 03:49 PM
Forget that in vb6, it's going to be easier to do this:


SELECT ident_field FROM table ORDER BY ident_field



then in the code:


'put some code in ehre to get a ado recordset
Dim i as Integer = WHATEVER_IDENT_STARTS_AT

While Not adoRS.EOF
While adoRS!ident_field <> i
MsgBox(i & " is not used")
i = i + 1
Wend
i = i + 1
adoRS.MoveNext
Wend


Thank you, Cjard.
The code worked like a charm.