[求助]怎样把数据更新到access中
编译可以通过但就是不行 截取关键代码如下 ;大家帮帮看看Case "保存"
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
'dzbh = ds.Tables("读者信息表").Rows(DataGrid1.CurrentRowIndex).Item(0)
Dim str As String
str = "update xinxi set 姓名 = '" & TextBox4.Text & "',所属部门 = '" & ComboBox1.SelectedItem & "',民族 = '" & TextBox5.Text & "',年龄 = '" & TextBox6.Text & "',性别 = '" & TextBox7.Text & "',职位 = '" & TextBox8.Text & "',学历 ='" & TextBox9.Text & "' where 员工ID = '" & TextBox3.Text & "'"
comm.Connection = conn
comm.CommandType = CommandType.Text
comm.CommandText = str
da.SelectCommand = comm
da.Fill(ds, "xinxi")
If Me.ds.Tables.Count <> 0 Then
ds.Clear()
comm.Connection = conn
comm.CommandType = CommandType.Text
comm.CommandText = "select * from xinxi "
da.SelectCommand = comm
da.Fill(ds, "xinxi")
MessageBox.Show("员工信息保存成功", "提示信息")
TextBox3.Enabled = False
TextBox4.Enabled = False
TextBox5.Enabled = False
ComboBox1.Enabled = False
TextBox6.Enabled = False
TextBox7.Enabled = False
TextBox8.Enabled = False
TextBox9.Enabled = False
Me.DataGrid1_Click(Nothing, Nothing)
ToolBarButton8.Enabled = False
End If