ADO Novice

From: Don (anonymous_at_discussions.microsoft.com)
Date: 05/17/04


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



Relevant Pages

  • ASP.NET ERROR
    ... 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. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • fileDownload Issue
    ... 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. ...
    (microsoft.public.dotnet.languages.csharp)
  • download issue
    ... 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. ...
    (microsoft.public.dotnet.languages.csharp)
  • Urgent: Invalid Procedure
    ... An unhandled exception occurred during the execution of the ... current web request. ... Please review the stack trace for more information about ...
    (microsoft.public.data.oledb)
  • fileDownload Issue
    ... 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. ...
    (microsoft.public.dotnet.languages.csharp)