Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Butto
这段代码那里错了DimstrsqlAsStringstrsql="select用户名,密码from用户表where用户名="&TextBox1.Text&"and密码="...
这段代码 那里错了
Dim strsql As String
strsql = "select用户名,密码from用户表where用户名=" & TextBox1.Text & "and 密码 = " & TextBox2.Text & ""
Dim myconn As New OleDb.OleDbConnection
Dim mycomm As New OleDb.OleDbCommand
Dim myadpt As New OleDb.OleDbDataAdapter
Dim myds As New DataSet
Try
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox("用户名不能为空!")
TextBox1.Focus()
TextBox2.Text = Nothing
Exit Sub
End If
myconn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=通讯录.mdb;fersist security info=false"
myconn.Open()
myconn = New System.Data.OleDb.OleDbConnection(strsql)
mycomm.CommandText = strsql
mycomm.Connection = myconn
myadpt.SelectCommand = mycomm
myadpt.Fill(myds) 展开
Dim strsql As String
strsql = "select用户名,密码from用户表where用户名=" & TextBox1.Text & "and 密码 = " & TextBox2.Text & ""
Dim myconn As New OleDb.OleDbConnection
Dim mycomm As New OleDb.OleDbCommand
Dim myadpt As New OleDb.OleDbDataAdapter
Dim myds As New DataSet
Try
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox("用户名不能为空!")
TextBox1.Focus()
TextBox2.Text = Nothing
Exit Sub
End If
myconn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=通讯录.mdb;fersist security info=false"
myconn.Open()
myconn = New System.Data.OleDb.OleDbConnection(strsql)
mycomm.CommandText = strsql
mycomm.Connection = myconn
myadpt.SelectCommand = mycomm
myadpt.Fill(myds) 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询