bd9000
asked on
objectdatasource incompatible with datasets?
I've been trying to get a dataset to work with an objectdatasource for an ASP.NET page.
The Select (FILL) works just fine, however the update, insert and delete do not work at all.
Is there an example anywhere showing a GridView bound to an ObjectDataSource bound to a DataSet?
The Select (FILL) works just fine, however the update, insert and delete do not work at all.
Is there an example anywhere showing a GridView bound to an ObjectDataSource bound to a DataSet?
http://blogs.msdn.com/bgold/archive/2005/05/05/415106.aspx
ASKER
I've been there already. There are no examples on any of those links for CRUD using ODS and DS.
I basically create a DataSet in the wizard and create all the procedures for inserting, updating, deleting and selecting from an SQL datastore.
Tested all procedures on the SQL side and via the VS2008 designer.
Created a new ObjectDataSource with the wizard and verified all parameters - they match - no errors.
Setup a grid using the ODS just created.
Run the page, all items show up in their respective columns, no problem.
Click an edit button, change a value, click Update, nothing happens, no errors, no changes in the SQL table, nada! The page is posted back and the update is indeed called, just updates nothing. The dataset is also not updated.
Paging works, sorting works, etc.
Just 1 single example showing UPDATE, DELETE, and INSERT working with a dataset designed by the dataset designer.
All works fine with an SQLDataSource, but I need to use an object (and I assumed that's why MS has the dataset designer - to reduce hours and days of hand coding every single business object!)
I basically create a DataSet in the wizard and create all the procedures for inserting, updating, deleting and selecting from an SQL datastore.
Tested all procedures on the SQL side and via the VS2008 designer.
Created a new ObjectDataSource with the wizard and verified all parameters - they match - no errors.
Setup a grid using the ODS just created.
Run the page, all items show up in their respective columns, no problem.
Click an edit button, change a value, click Update, nothing happens, no errors, no changes in the SQL table, nada! The page is posted back and the update is indeed called, just updates nothing. The dataset is also not updated.
Paging works, sorting works, etc.
Just 1 single example showing UPDATE, DELETE, and INSERT working with a dataset designed by the dataset designer.
All works fine with an SQLDataSource, but I need to use an object (and I assumed that's why MS has the dataset designer - to reduce hours and days of hand coding every single business object!)
<asp:ObjectDataSource ID="ODSAdminMerchantLinks" runat="server" DeleteMethod="Delete" EnablePaging="True"
InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectCountMethod="CountMerchLinks"
SelectMethod="GetData" UpdateMethod="Update" TypeName="DSAdminMerchLinksTableAdapters.LinksTableAdapter">
<DeleteParameters>
<asp:Parameter Name="Original_LinkID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="MerchName" Type="String" />
<asp:Parameter Name="MerchDescr" Type="String" />
<asp:Parameter Name="BannerCode" Type="String" />
<asp:Parameter Name="BannerImagePath" Type="String" />
<asp:Parameter Name="TextLinkCode" Type="String" />
<asp:Parameter Name="TextLinkText" Type="String" />
<asp:Parameter Name="MerchSource" Type="String" />
<asp:Parameter Name="IsFree" Type="Boolean" />
<asp:Parameter Name="IsFeatured" Type="Boolean" />
<asp:Parameter Name="Keywords" Type="String" />
<asp:Parameter Name="CommPct" Type="Decimal" />
<asp:Parameter Name="CommPerClick" Type="Decimal" />
<asp:Parameter Name="CommPerSale" Type="Decimal" />
<asp:Parameter Name="SiteURL" Type="String" />
<asp:Parameter Name="SEKeywords" Type="String" />
<asp:Parameter Name="SEName" Type="String" />
<asp:Parameter Name="SETitle" Type="String" />
<asp:Parameter Name="SEDescr" Type="String" />
<asp:Parameter Name="SENoScript" Type="String" />
<asp:Parameter Name="SEAltText" Type="String" />
<asp:Parameter Name="Published" Type="Boolean" />
<asp:Parameter Name="Deleted" Type="Boolean" />
<asp:Parameter Name="CssClassName" Type="String" />
<asp:Parameter Name="CssClassTextLinkText" Type="String" />
<asp:Parameter Name="CssClassMerchDescr" Type="String" />
<asp:Parameter Name="DisplayOrder" Type="Int32" />
<asp:Parameter Name="Original_LinkID" Type="Int32" />
</UpdateParameters>
<SelectParameters>
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="MerchName" Type="String" />
<asp:Parameter Name="MerchDescr" Type="String" />
<asp:Parameter Name="BannerCode" Type="String" />
<asp:Parameter Name="BannerImagePath" Type="String" />
<asp:Parameter Name="TextLinkCode" Type="String" />
<asp:Parameter Name="TextLinkText" Type="String" />
<asp:Parameter Name="MerchSource" Type="String" />
<asp:Parameter Name="IsFree" Type="Boolean" />
<asp:Parameter Name="IsFeatured" Type="Boolean" />
<asp:Parameter Name="Keywords" Type="String" />
<asp:Parameter Name="CommPct" Type="Decimal" />
<asp:Parameter Name="CommPerClick" Type="Decimal" />
<asp:Parameter Name="CommPerSale" Type="Decimal" />
<asp:Parameter Name="SiteURL" Type="String" />
<asp:Parameter Name="SEKeywords" Type="String" />
<asp:Parameter Name="SEName" Type="String" />
<asp:Parameter Name="SETitle" Type="String" />
<asp:Parameter Name="SEDescr" Type="String" />
<asp:Parameter Name="SENoScript" Type="String" />
<asp:Parameter Name="SEAltText" Type="String" />
<asp:Parameter Name="Published" Type="Boolean" />
<asp:Parameter Name="Deleted" Type="Boolean" />
<asp:Parameter Name="CssClassName" Type="String" />
<asp:Parameter Name="CssClassTextLinkText" Type="String" />
<asp:Parameter Name="CssClassMerchDescr" Type="String" />
<asp:Parameter Name="DisplayOrder" Type="Int32" />
</InsertParameters>
</asp:ObjectDataSource>
Hi! Try this one. Hope this helps.
http://www.15seconds.com/Issue/050721.htm
http://www.15seconds.com/issue/050728.htm
http://www.15seconds.com/Issue/050721.htm
http://www.15seconds.com/issue/050728.htm
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.