vb.net+access执行出错:至少一个参数没有被指定值
ProtectedSubButton1_Click(ByValsenderAsObject,ByValeAsEventArgs)HandlesButton1.ClickI...
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
If (TextBox1.Text <> "" And TextBox2.Text <> "") Then
Dim myConn1 As String = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source =03shuju.mdb"
Dim myConn As OleDb.OleDbConnection = New OleDb.OleDbConnection(myConn1)
myConn.Open()
Dim strInsert As String = " INSERT INTO 用户表 (用户名, 密码 )VALUES(TextBox1.Text,TextBox2.Text)"
Dim inst As OleDb.OleDbCommand = New OleDb.OleDbCommand(strInsert, myConn)
inst.ExecuteNonQuery()
myConn.Close()
Else
End If
End Sub
End Class 展开
If (TextBox1.Text <> "" And TextBox2.Text <> "") Then
Dim myConn1 As String = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source =03shuju.mdb"
Dim myConn As OleDb.OleDbConnection = New OleDb.OleDbConnection(myConn1)
myConn.Open()
Dim strInsert As String = " INSERT INTO 用户表 (用户名, 密码 )VALUES(TextBox1.Text,TextBox2.Text)"
Dim inst As OleDb.OleDbCommand = New OleDb.OleDbCommand(strInsert, myConn)
inst.ExecuteNonQuery()
myConn.Close()
Else
End If
End Sub
End Class 展开
1个回答
展开全部
这种情况遇到多了,要不就是你在写出值的时候伏纳高,名称不对了,或者你检索你的sql语句看看,是不是字段值和数据表的没有对应,出错了,你先把sql打印出来对照表看看,没错了,看看你下面检索字段值的名称写对了没有,基本就是这两种情况,你多打印几缺尺次值看看,就能茄庆排查出错误了
更多追问追答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询