空值异常 - Vb.Net

时间:2015-09-14 08:28:30

标签: database vb.net ms-access oledb

  Private Sub Button4_Click_1(sender As Object, e As EventArgs) Handles Button4.Click
    Dim ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & TextBox1.Text
    Dim SQLString As String = "SELECT * FROM " & ComboBox1.Text
    Dim OleDBConn1 As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(ConnString)
    Dim DataSet1 As New DataSet()
    Dim OleDbDataAdapter1 As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(SQLString, OleDBConn1)
    OleDBConn1.Open()
    OleDbDataAdapter1.Update(DataSet1.Tables(ComboBox1.Text))
    DataSet1.AcceptChanges()
    OleDBConn1.Close()
End Sub

此代码在更新时提升空值异常

0 个答案:

没有答案