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