當傳遞擁有新資料列的 DataRow 集合時,更新需要有效的 InsertCommand。
請問上面這句錯誤訊息是什麼意思呢?
我的程式碼如下
......
行 40: objDataRow["NickName"] = "xxx";
行 41: objDataSet.Tables["Player"].Rows.Add(objDataRow);
行 42: int count=objDataAdapter.Update(objDataSet,"Player");
行 43: objCon.Close();
還請高手指點 謝謝!
--
下面是堆疊追蹤
[InvalidOperationException: 當傳遞擁有新資料列的 DataRow 集合時,更新需要有效
的 InsertCommand。]
System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) +252
System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) +46
System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping) +1765
System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable,
DataTableMapping tableMapping) +41
System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
+181
ASP.dbpractice_aspx.__Render__control1(HtmlTextWriter __w, Control
parameterContainer) in c:\Inetpub\wwwroot\Ch10\DBPractice.aspx:42
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) +98
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +21
System.Web.UI.Page.Render(HtmlTextWriter writer) +27
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
ControlAdapter adapter) +53
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter
adapter) +280
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +24
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7423
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.64.83.154
※ 編輯: oishii 來自: 210.64.83.154 (04/05 15:49)