#2
xyxcc1772018-02-05 17:14
|
调用下面的函数保存数据, 数据为什么保存不了?请各位大侠帮我分析分析,指出解决方案。谢谢!
Private Function Save_Data() As Boolean '保存数据
Dim AccessString As String = "select * FROM 个人信息"
Dim AccessConn As New OleDb.OleDbConnection(AccessConnectionString)
AccessConn.Open()
Dim AccessAdapter As OleDbDataAdapter = New OleDbDataAdapter(AccessString, AccessConn)
Dim AccessCmdBulid As New OleDb.OleDbCommandBuilder(AccessAdapter)
Try
AccessAdapter.Update(DataGridView1.DataSource)
Return True
Catch ex As Exception
Console.WriteLine(ex.Message)
MsgBox("数据保存失败!" & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical)
Return False
Finally
AccessAdapter.Dispose()
AccessCmdBulid.Dispose()
End Try
End Function