gtjr92 Posted May 12, 2005 Posted May 12, 2005 This is for an asp.net 2.0 site, but I think the VB should be similiar. I am using an access datasource, I set up a sub update db that checks the textboxes and updateds the Database. Basically I want a fully editable Gridview. i think Sqlcommandevent args is what i need I believe sql and access share some properties. Here is my error, my code is below that. I understand(i think) why i am getting the error but I am not sure how to correct it. BC30408: Method 'Public Sub Updatedb(sender As Object, e As System.Web.UI.WebControls.SqlDataSourceCommandEven tArgs)' does not have the same signature as delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'. Source Error: Line 126: <div style="z-index: 103; left: 307px; width: 65px; position: absolute; top: 653px; Line 127: height: 28px"> Line 128: <asp:Button ID="Button1" runat="server" Text="Update Tithe" OnClick=Updatedb /></div> Line 129: <%-- <asp:AccessDataSource ID="Titheupdate" runat="server" DataFile="~/App_Data/tithe/GBCTITHE.MDB" Line 130: UpdateCommand="UPDATE [Tithe] SET [WkID] = ?, [People_ID] = ?, [Tithe] = ?, [Education] = ?, [special] = ?, [Missions] = ?, [Gift_Item] = ?, [Gift_Value] = ? WHERE [TRID] = ?"> Sub Updatedb(ByVal sender As Object, ByVal e As SqlDataSourceCommandEventArgs) Dim dgi As GridViewRow For Each dgi In GridView1.Rows 'Read in the Primary Key Field Dim id As Integer = (GridView1.DataKeys(dgi.RowIndex).Value.ToString() ) Dim Titheup As Decimal = CType(dgi.FindControl("TxtTithe"), TextBox).Text e.Command.Parameters("@Titheup").Value = e.Command.Parameters("@TitheParam").Value e.Command.Parameters("@id").Value = e.Command.Parameters("@Tridparam").Value e.Command.Parameters.Remove(e.Command.Parameters("@TitheParam")) e.Command.Parameters.Remove(e.Command.Parameters("@ID")) dsoTithe.Update() Next End Sub 'I tried it this way too.. 'Same type of error for this too Sub Updatedb(ByVal sender As Object, ByVal e As AccessDataSourceView) Dim dgi As GridViewRow For Each dgi In GridView1.Rows 'Read in the Primary Key Field Dim id As Integer = (GridView1.DataKeys(dgi.RowIndex).Value.ToString() ) Dim Titheup As Decimal = CType(dgi.FindControl("TxtTithe"), TextBox).Text 'e.UpdateParameters. e.UpdateParameters("@Titheup") = e.UpdateParameters("@TitheParam") e.UpdateParameters("@id") = e.UpdateParameters("@Tridparam") e.UpdateParameters.Clear() dsoTithe.Update() Quote
Administrators PlausiblyDamp Posted May 12, 2005 Administrators Posted May 12, 2005 A button click has the event signature Delegate Sub EventHandler(sender As Object, e As System.EventArgs) i.e. it accepts 2 parameters. The first being an object and the second of type System.EventArgs. You are trying to assign a method with a different signature Sub Updatedb(ByVal sender As Object, ByVal e As AccessDataSourceView) to this event handler - hence the error message. The buton click event has no idea what a AccessDataSourceView or a SqlDataSourceCommandEventArgs is. In your code where are the SqlDataSourceCommandEventArgs / AccessDataSourceView objects being created / updated? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
gtjr92 Posted May 12, 2005 Author Posted May 12, 2005 Re: In your code where are the SqlDataSourceCommandEventArgs / AccessDataSourceView objects being created / updated? that is here <form id="form2" runat="server"> <div> <asp:AccessDataSource ID="dsoTithe" runat="server" DataFile="~/App_Data/tithe/GBCTITHE.MDB" SelectCommand="SELECT [Weeks_Date], [People_ID], [Name], [Tithe], [Education], [Missions], [special], [Gift_Item], [Gift_Value], [WkID], [TRID] FROM [tithe] WHERE ([WkID] = ?)" UpdateCommand="UPDATE [Tithe] SET [Tithe]=? Where [trid]=?"> <UpdateParameters> <asp:Parameter Name="Titheparam" Type="Decimal" /> <asp:Parameter Name="Tridparam" Type="Int32" /> </UpdateParameters> <SelectParameters> <asp:ControlParameter ControlID="lbxWeeks" DefaultValue="1" Name="WkID" PropertyName="SelectedValue" Type="Double" /> </SelectParameters> </asp:AccessDataSource> Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.