重新初始化数据库表的id列 [英] re-initializing id column of database table

查看:132
本文介绍了重新初始化数据库表的id列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以给我打电话的代码,当表为空时再次从1重新初始化id列.我正在使用sql express作为我的后端...我尝试了这段代码:

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>

推荐答案

使用SQL"TRUNCATE TABLE"查询初始化表的主键.
http://msdn.microsoft.com/en-us/library/ms177570.aspx [ ^ ]
http://www.orafaq.com/faq/difference_between_truncate_delete_and_drop_commands [
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[^]


这篇关于重新初始化数据库表的id列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆