vb.net连接数据库?access
1个回答
展开全部
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\Data.mdb"
Dim myConn As OleDbConnection = New OleDbConnection(strConn)
myConn.Open()
Dim TestCommand As OleDbCommand = New OleDbCommand("SELECT Count(*) FROM 开奖结果 WHERE 期号=" & TextBox1.Text, myConn)
str = TestCommand.ExecuteScalar()
If Val(str) > 0 Then
myConn.Close()
MsgBox("数据库中已经存在" & TextBox1.Text & "期结果,请勿重复输入!")
Exit Sub
End If
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询