therookie32
Member
- Joined
- Jan 31, 2006
- Messages
- 5
- Programming Experience
- Beginner
I have just been trying to use a dataset to populate a gridview and have a pretty standard table that i created for test purposes:
tblTest
TestID
TestName
StateID
PersonTypeID
The gridview populates properly with the adapter for it in my dataset and I created all the default commands for it but when I try to do an update with the gridview it is bound to I get this error:
Error Message:
ObjectDataSource 'TestDataset' could not find a non-generic method 'Update' that has parameters: TestName, StateID, PersonTypeID, original_TestID.
Code:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="TestID" DataSourceID="TestDataset">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="TestName" HeaderText="TestName" SortExpression="TestName" />
<asp:BoundField DataField="StateID" HeaderText="StateID" SortExpression="StateID" />
<asp:BoundField DataField="PersonTypeID" HeaderText="PersonTypeID" SortExpression="PersonTypeID" />
<asp:BoundField DataField="TestID" HeaderText="TestID" ReadOnly="True" SortExpression="TestID" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="TestDataset" runat="server" DeleteMethod="Delete" InsertMethod="Insert"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetTest" TypeName="AOATableAdapters.TestTableAdapter"
UpdateMethod="Update">
<DeleteParameters>
<asparameter Name="Original_TestID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="TestName" Type="String" />
<asparameter Name="StateID" Type="Int32" />
<asparameter Name="PersonTypeID" Type="Int32" />
<asparameter Name="TestID" Type="Int32" />
<asparameter Name="Original_TestID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asparameter Name="TestName" Type="String" />
<asparameter Name="StateID" Type="Int32" />
<asparameter Name="PersonTypeID" Type="Int32" />
<asparameter Name="TestID" Type="Int32" />
</InsertParameters>
</asp:ObjectDataSource>
Update Command from Dataset:
UPDATE Test
SET TestName = @TestName, StateID = @StateID, PersonTypeID = @PersonTypeID, TestID = @TestID
WHERE (TestID = @Original_TestID)
tblTest
TestID
TestName
StateID
PersonTypeID
The gridview populates properly with the adapter for it in my dataset and I created all the default commands for it but when I try to do an update with the gridview it is bound to I get this error:
Error Message:
ObjectDataSource 'TestDataset' could not find a non-generic method 'Update' that has parameters: TestName, StateID, PersonTypeID, original_TestID.
Code:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="TestID" DataSourceID="TestDataset">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="TestName" HeaderText="TestName" SortExpression="TestName" />
<asp:BoundField DataField="StateID" HeaderText="StateID" SortExpression="StateID" />
<asp:BoundField DataField="PersonTypeID" HeaderText="PersonTypeID" SortExpression="PersonTypeID" />
<asp:BoundField DataField="TestID" HeaderText="TestID" ReadOnly="True" SortExpression="TestID" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="TestDataset" runat="server" DeleteMethod="Delete" InsertMethod="Insert"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetTest" TypeName="AOATableAdapters.TestTableAdapter"
UpdateMethod="Update">
<DeleteParameters>
<asparameter Name="Original_TestID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asparameter Name="TestName" Type="String" />
<asparameter Name="StateID" Type="Int32" />
<asparameter Name="PersonTypeID" Type="Int32" />
<asparameter Name="TestID" Type="Int32" />
<asparameter Name="Original_TestID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asparameter Name="TestName" Type="String" />
<asparameter Name="StateID" Type="Int32" />
<asparameter Name="PersonTypeID" Type="Int32" />
<asparameter Name="TestID" Type="Int32" />
</InsertParameters>
</asp:ObjectDataSource>
Update Command from Dataset:
UPDATE Test
SET TestName = @TestName, StateID = @StateID, PersonTypeID = @PersonTypeID, TestID = @TestID
WHERE (TestID = @Original_TestID)