问题描述
我在建立新数据集条目的 ID 时遇到问题。新条目为 ID 返回 NullValue,但如果我得到 item(1) 或更大的值,那么我会得到正常数据。
Dim id as integer
dbProvider = "Provider=Microsoft.JET.OLEDB.4.0;"
TheDatabase = "\dbMag.mdb"
MyDocFolder = Directory.GetCurrentDirectory()
FullDatabasePath = MyDocFolder & TheDatabase
dbSource = "Data Source = " & FullDatabasePath
con.ConnectionString = dbProvider & dbSource
Try
con.Open()
sqlString = "SELECT * FROM mag"
da = New OleDb.OleDbDataAdapter(sqlString,con)
da.Fill(ds,"mag")
con.Close()
Catch ex As Exception
MsgBox("Błąd: ",Err.Description)
End Try
Dim cb As New OleDb.OleDbCommandBuilder(da)
dsNewRow = ds.Tables("mag").NewRow()
With dsNewRow
'do something
end with
ds.Tables("mag").Rows.Add(dsNewRow)
da.Update(ds,"mag")
lastrow = ds.Tables("mag").Rows.Count - 1
id = ds.Tables("mag").Rows(lastrow).Item(0)
id 返回 NullValue
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)