Can't Update SQL Database Via GridView


A

A_StClaire_

hi all,

I am using a GridView bound to an ObjectDataSource. edit and delete
functionality has been enabled. my ObjectDataSource is tied to a
TableAdapter that accesses three stored procedures - SPGetAllPrograms
(Select), SPDeleteProgram (Delete) and SPRetireProgram (Update).
deleting database records via clicking the GridView Delete button works
fine. as does the Select function.

however after clicking the Edit button and making changes to fields,
confirming the update by clicking 'Update' results in an exception:

"ObjectDataSource 'objDSGetAllPrograms' could not find a non-generic
method 'SPRetireProgram' that has parameters: targetRetired,
targetRetiredDate, original_programID, retired, retiredDate."

does anyone have any insight? I've attached the code for my GridView
as well as ObjectDataSource.

thx a million


<asp:GridView ID="gvRetireDelete" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" CellPadding="4"
DataKeyNames="programID"
DataSourceID="objDSGetAllPrograms" ForeColor="#333333"
GridLines="None">
<FooterStyle BackColor="#1C5E55" Font-Bold="True"
ForeColor="White" />
<Columns>
<asp:BoundField DataField="programID"
HeaderText="programID"
InsertVisible="False" ReadOnly="True"
SortExpression="programID" />
<asp:BoundField DataField="programName"
HeaderText="programName" ReadOnly="True"
SortExpression="programName" />
<asp:BoundField DataField="departmentName"
HeaderText="departmentName"
ReadOnly="True" SortExpression="departmentName" />
<asp:BoundField DataField="description"
HeaderText="description" ReadOnly="True"
SortExpression="description" />
<asp:BoundField DataField="creationDate"
HeaderText="creationDate"
ReadOnly="True" SortExpression="creationDate" />
<asp:CheckBoxField DataField="retired" HeaderText="retired"
SortExpression="retired" />
<asp:BoundField DataField="retiredDate"
HeaderText="retiredDate"
SortExpression="retiredDate" />
<asp:CommandField ButtonType="Button" EditText="Retire"
InsertVisible="False"
ShowDeleteButton="True" ShowEditButton="True"
UpdateText="Confirm" />
</Columns>
<RowStyle BackColor="#E3EAEB" />
<EditRowStyle BackColor="#7C6F57" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True"
ForeColor="#333333" />
<PagerStyle BackColor="#666666" ForeColor="White"
HorizontalAlign="Center" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>

<asp:ObjectDataSource ID="objDSGetAllPrograms" runat="server"
OldValuesParameterFormatString="original_{0}"
TypeName="dsMainTableAdapters.GetAllProgramsTableAdapter"
SelectMethod="SPGetAllPrograms"
DeleteMethod="SPDeleteProgram"
UpdateMethod="SPRetireProgram">
<DeleteParameters>
<asp:parameter Name="original_programID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:parameter Name="targetRetired" Type="Boolean" />
<asp:parameter Name="targetRetiredDate" Type="DateTime" />
<asp:parameter Name="original_programID" Type="Int32" />
</UpdateParameters>
</asp:ObjectDataSource>
 
Ad

Advertisements

C

carl

The problem probably lies in the objDSGetAllPrograms class. The method
SPRetireProgram is either Generic (objDSGetAllPrograms<T>) or does not
have an overload with the parameters targetRetired,
targetRetiredDate, original_programID, retired, and retiredDate. I
don't see the retired or retiredDate parameters in the ObjectDataSource
or GridView you posted, so I don't know why you're seeing them in the
error message. If you post the objDSGetAllPrograms source it may shed
some light on the problem.

-Carl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top