Auto-build UpdateCommand Statement
Posted on 2008-06-10
I am writing an application that changes the datagrid dynamically when a dropdown value is changed.
Works fine - but I'd like for it to auto-generate the updatecommand for me when the selectcommand is changed.
Using this code:
SqlDataSource1.SelectCommand = "select * from tableA"
In this case; you can edit the datagrid; the updatecommand is built for me at compile.
When the dropdown is changed using
SqlDataSource1.SelectCommand = "select * from " & DropDownList1.Text
The datagrid updates fine, but the updatecommand is still using the previous sql.
I can build an updatecommand statement with parameters for every possible dropdown table (25 diff tables); but If there is an easy way to force it to 'update' the updatecommand based on a new selectcommand; that would be optimal.
Thanks for any help.