[IndexOutOfRangeException: There is no row at position 12236.]
- From: "mikodmc" <mikodmc@xxxxxxxxxxxxxxxx>
- Date: Mon, 25 Apr 2005 09:19:01 -0600
I have a aspx web form for user's to enter data and save to a sql database.
I have a dataset, sqlconnection, and dataadapter controls set up. When the
user creates a new record, the record number is created and a row saved to
the database with that record number as the primary key. My problem is
after the user enters fields on the web form and clicks the 'Save' button
(this actually updates new newly created record/row) I get the error message
in the Subject line above. Here the code behind the 'Save' button.
Private Sub btnSaveNewMS_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSaveNewMS.Click
If Me.IsValid Then
' Perform database updates or other logic here
Dim saveMSnum As Integer
saveMSnum = txtMSNumber.Text
Try
SqlConnection2.Open()
SqlDataAdapterMSTable.MissingSchemaAction = MissingSchemaAction.AddWithKey
SqlDataAdapterMSTable.Fill(DataSetTYPE, "MonsterSheetTable")
SqlDataAdapterMSTable.Update(DataSetTYPE.MonsterSheetTable.Rows(saveMSnum).I
tem("Type") = ddlType.SelectedItem.Text)
Finally
SqlConnection2.Close()
End Try
Else
MsgBox("NOT ALL REQUIRED FIELDS HAVE BEEN ENTERED")
End If
End Sub
Here's the error message.
Server Error in '/MONSTER ***' Application.
There is no row at position 12236.
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.IndexOutOfRangeException: There is no row at
position 12236.
Source Error:
Line 869:
Line 870:
Line 871:
SqlDataAdapterMSTable.Update(DataSetTYPE.MonsterSheetTable.Rows(saveMSnum).I
tem("Type") = ddlType.SelectedItem.Text)
Line 872:
Line 873:
Source File: c:\inetpub\wwwroot\MONSTER ***\NewMS.aspx.vb Line: 871
Stack Trace:
[IndexOutOfRangeException: There is no row at position 12236.]
System.Data.DataRowCollection.get_Item(Int32 index)
MONSTER_***.NewMS.btnSaveNewMS_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\MONSTER ***\NewMS.aspx.vb:871
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032
Can anyone HELP!
Thanks,
Miko
.
- Prev by Date: VS 2003 and 2005
- Next by Date: Re: VS 2003 and 2005
- Previous by thread: VS 2003 and 2005
- Next by thread: MS Development Environment has not been installed for the current
- Index(es):