i made a login table and i am filling records in it through my datagridview but when i delete all the records and make the table empty and then when i put the record in the login table it takes 1 no ahead of last deleted record .i want it to start the id column of login table from 1 again whent it is empty.i am using sql express 2008

Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
        Dim i As Integer
        i = DataGridView1.CurrentRow.Index
        TxtId.Text = DataGridView1.Item(0, i).Value
        TxtUsername.Text = DataGridView1.Item(1, i).Value
        TxtPassword.Text = DataGridView1.Item(2, i).Value
        If DataGridView1.Item(0, 0).Value = vbEmpty Then
            DataGridView1.Item(0, 0).Value=initialize

End If

Recommended Answers

All 2 Replies

You should truncate the table to get the ID back to 1. If the Id column is set to increment seed.

Answered here

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.