i want to initialize my id column of my databse tables by 1 again when i empty the table..i tried this code but it is not working..

Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
02
        Dim i As Integer
03

04
        i = DataGridView1.CurrentRow.Index
05
        TxtId.Text = DataGridView1.Item(0, i).Value
06
        TxtUsername.Text = DataGridView1.Item(1, i).Value
07
        TxtPassword.Text = DataGridView1.Item(2, i).Value
08

09

10
        [b]If DataGridView1.Item(0, 0).Value = vbEmpty Then
11
            DataGridView1.Item(0, 0).Value=initialize
12
[/b]
13

14
End If

Hi,

If you want to reseed an identity column in SQL server you would use this:
CAUTION Be Very careful before doing this

DBCC CHECKIDENT (orders, RESEED, 0)

Reseed Identity

but where do i use this code in my code .i am not getting how to excute this command in my table..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.