[VB.NET]数据库表的初始化问题

前端之家收集整理的这篇文章主要介绍了[VB.NET]数据库表的初始化问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
数据库表的初始化问题 数据库数据初始化(清空表中数据,恢复空表),库中有one two three三个表,窗体上可使用CheckBox选择为哪些表初始化数据,请问初始化按钮的代码怎么写,谢谢。 __________________________________________________________________________ 该回复于2008-08-05 03:39:54被管理员或版主删除 __________________________________________________________________________ Private Sub Button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button2.Click If CheckBox1.Checked = True Then Conn = New OleDbConnection(Provider & "; " & Database) Conn.Open() sql = "Delete From one " Cmd = New OleDbCommand(sql,Conn) Cmd.ExecuteReader() Conn.Close() MessageBox.Show( "one已经清空! ") End If If CheckBox2.Checked = True Then Conn = New OleDbConnection(Provider & "; " & Database) Conn.Open() sql = "Delete From two " Cmd = New OleDbCommand(sql,Conn) Cmd.ExecuteReader() Conn.Close() MessageBox.Show( "two已经清空! ") End If If CheckBox3.Checked = True Then Conn = New OleDbConnection(Provider & "; " & Database) Conn.Open() sql = "Delete From three " Cmd = New OleDbCommand(sql,Conn) Cmd.ExecuteReader() Conn.Close() MessageBox.Show( "three已经清空! ") End If End Sub __________________________________________________________________________ fish__net谢谢,虽然我用的是sqlconnection但差不多 __________________________________________________________________________ 有用就好! __________________________________________________________________________ 原文链接:https://www.f2er.com/vb/263882.html

猜你在找的VB相关文章