| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 658 人关注过本帖
标题:[求助]关于用DataSet修改数据
只看楼主 加入收藏
jackzhang
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-8-6
收藏
 问题点数:0 回复次数:0 
[求助]关于用DataSet修改数据

    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编辑过]

搜索更多相关主题的帖子: DataSet Microsoft 数据 
2006-08-06 22:17
快速回复:[求助]关于用DataSet修改数据
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028567 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved