ADO Novice
From: Don (anonymous_at_discussions.microsoft.com)
Date: 05/17/04
- Next message: Damien Foggon: "Return value problem"
- Previous message: Paul: "Re: using add key in webconfig file."
- Next in thread: Miha Markic [MVP C#]: "Re: ADO Novice"
- Reply: Miha Markic [MVP C#]: "Re: ADO Novice"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 17 May 2004 13:46:09 -0700
sSQL = "Select * from SeqGen where SG_NumType = '" & which & "'"
oSGRs = New SqlDataAdapter(sSQL, oConn)
oSGRs.MissingSchemaAction = MissingSchemaAction.AddWithKey
RecCnt = oSGRs.Fill(oDataSet, "SeqGen")
If RecCnt = 0 Then
myRow = oDataSet.Tables("SeqGen").NewRow()
myRow("SG_NumType") = UCase(which)
myRow("SG_CurrentValue") = 1
oDataSet.Tables("SeqGen").Rows.Add(myRow)
oSGRs.Update(oDataSet, "SeqGen")
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Update requires a valid InsertCommand when passed DataRow collection with new rows.
Source Error:
Line 85: myRow("SG_CurrentValue") = 1
Line 86: oDataSet.Tables("SeqGen").Rows.Add(myRow)
Line 87: oSGRs.Update(oDataSet, "SeqGen")
Question: Can't I update a table the old way like I did in ADO? Help.
Thanks, Don
- Next message: Damien Foggon: "Return value problem"
- Previous message: Paul: "Re: using add key in webconfig file."
- Next in thread: Miha Markic [MVP C#]: "Re: ADO Novice"
- Reply: Miha Markic [MVP C#]: "Re: ADO Novice"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|