Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can anybody tel me the code for re-initializing the id column from 1 again when the table is made empty.i am using sql express as my back end ...i tried this code:

 <pre lang="vb">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</pre>
Posted

1 solution

Use the SQL 'TRUNCATE TABLE' query for initializing the primary key of the table .
http://msdn.microsoft.com/en-us/library/ms177570.aspx[^]
http://www.orafaq.com/faq/difference_between_truncate_delete_and_drop_commands[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900