我从下面的代码中收到错误“更新语句中的语法错误”:

时间:2013-08-20 10:45:55

标签: vb.net

我从下面的代码中收到错误“Update语句中的语法错误”:

Public Class Emp

Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter
Dim sql As String
Dim inc As Integer
Dim MaxRows As Integer


Private Sub Emp_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    dbProvider = "Provider=Microsoft.Ace.OLEDB.12.0;"
    dbSource = "Data Source = C:\Users\Blessing\Documents\IBCARIP.accdb"
    con.ConnectionString = dbProvider & dbSource
    con.Open()
    sql = "SELECT * From Employees"
    da = New OleDb.OleDbDataAdapter(sql, con)
    da.Fill(ds, "IBCARIP")
    'con.Close()
    txtID.Text = ds.Tables("IBCARIP").Rows(0).Item(0)
    txtName.Text = ds.Tables("IBCARIP").Rows(0).Item(1)
    MaxRows = ds.Tables("IBCARIP").Rows.Count
    inc = -1
End Sub

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    If InputBox("Please enter Clearance Level 1 Code", ) <> "me" Then
        MsgBox("Invalid clearence code entered. Please make sure you have enough previlegies to perfom this operation..!", MsgBoxStyle.OkOnly)
    Else
        Dim cb As New OleDb.OleDbCommandBuilder(da)
        ds.Tables("IBCARIP").Rows(inc).Item(0) = txtID.Text
        ds.Tables("IBCARIP").Rows(inc).Item(1) = txtName.Text
        da.Update(ds, "IBCARIP")   <<<<<<<<<<<<<<<<<<<<<<<<<<<<SYNTAX ERROR IN UPDATE STATEMENT
    End If
End Sub

有人可以帮忙吗

0 个答案:

没有答案