Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
All-Star
35986 Points
6550 Posts
Dec 20, 2008 05:23 PM|LINK
Did you read the article about parameter query's? Your SQL is not complicated att all, so it should be very easy to change the examples to your situation!
Anyway, try this:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" DataKeyNames="ScenarioID" DataSourceID="AccessDataSource1" PageSize="16" AllowSorting="True" AutoGenerateColumns="true" > <Columns> <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" /> </Columns> </asp:GridView> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/AccountInfo.mdb" SelectCommand="SELECT Scenario.* from Scenario" UpdateCommand="UPDATE Scenario SET BusinessStartYear = ?, ReportingStart = ?, ReportingEnd = ?, FilterString = ? WHERE ScenarioID = ?" DeleteCommand="DELETE FROM Scenario WHERE ScenarioID = ?" > <UpdateParameters> <asp:Parameter Name="BusinessStartYear" Type="Int32" /> <asp:Parameter Name="ReportingStart" Type="DateTime" /> <asp:Parameter Name="ReportingEnd" Type="DateTime" /> <asp:Parameter Name="FilterString" Type="String" /> <asp:Parameter Name="ScenarioID" Type="Int32" /> </UpdateParameters> <DeleteParameters> <asp:Parameter Name="ScenarioID" Type="Int32" /> </DeleteParameters> </asp:AccessDataSource>
Only check the Types of the parameters, since I don't know what datatype the are!
hans_v
All-Star
35986 Points
6550 Posts
Re: The data is not updating the data; What am I doing wrong?
Dec 20, 2008 05:23 PM|LINK
Did you read the article about parameter query's? Your SQL is not complicated att all, so it should be very easy to change the examples to your situation!
Anyway, try this:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" DataKeyNames="ScenarioID" DataSourceID="AccessDataSource1" PageSize="16" AllowSorting="True" AutoGenerateColumns="true" > <Columns> <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" /> </Columns> </asp:GridView> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/AccountInfo.mdb" SelectCommand="SELECT Scenario.* from Scenario" UpdateCommand="UPDATE Scenario SET BusinessStartYear = ?, ReportingStart = ?, ReportingEnd = ?, FilterString = ? WHERE ScenarioID = ?" DeleteCommand="DELETE FROM Scenario WHERE ScenarioID = ?" > <UpdateParameters> <asp:Parameter Name="BusinessStartYear" Type="Int32" /> <asp:Parameter Name="ReportingStart" Type="DateTime" /> <asp:Parameter Name="ReportingEnd" Type="DateTime" /> <asp:Parameter Name="FilterString" Type="String" /> <asp:Parameter Name="ScenarioID" Type="Int32" /> </UpdateParameters> <DeleteParameters> <asp:Parameter Name="ScenarioID" Type="Int32" /> </DeleteParameters> </asp:AccessDataSource>Only check the Types of the parameters, since I don't know what datatype the are!