Dim strConStr as String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=D:\WebSiteTest\MyWeb.mdb"
dim strComStr as String="select * from member"
dim dscA as OleDbDataAdapter = New OleDbDataAdapter(strComstr,strConStr)
dim dsDataSet As DataSet = New DataSet()
dscA.Fill(dsDataSet,"member")
dsDataSet.Tables("member").rows(0)(0)="abcd"
dscA.Update(dsDataSet,"member")
AddTableToTable(dsDataSet)
上面红字的那行总是编译不过去,错误如下:
Exception Details: System.InvalidOperationException: Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
Stack Trace:
[InvalidOperationException: Update requires a valid UpdateCommand when passed DataRow collection with modified rows.]
System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) +1381996
System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) +46
System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping) +1747
System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping) +40
System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable) +183
ASP.testdataset1_aspx.Page_Load(Object sender, EventArgs e) in D:\WebSiteTest\testDataSet1.aspx:29
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
[此贴子已经被作者于2006-8-6 22:23:17编辑过]