错误消息:VB.net中的查询值和目标字段数不同

时间:2017-10-17 11:54:11

标签: vb.net

您认为导致错误的原因是什么? 它在我在MS Access数据库中添加新字段之前有效,是错误的原因

    Dim conn As New 
    OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data 
    Source=C:\Users\JA\Documents\Sample_LogIn.accdb")
    Dim insert As String = "Insert into Students values
         ('" & textID.Text & "', " &
            "'" & textFirstName.Text & "', " &
            "'" & textLastName.Text & "', " &
            "'" & textPassword.Text & "')"
    Dim cmd As New OleDbCommand(insert, conn)
    conn.Open()
    cmd.ExecuteNonQuery()
    MsgBox("Successfully created new account.")
    Me.Close()
Catch ex As Exception
    MsgBox("Error encountered while creating new account." & vbCrLf & 
              "Ërror: " & ex.Message)

0 个答案:

没有答案