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!
I think you won't learn anything if I would give you yet another example. You know the queries, you can see the parameters, again read
this and you should be able to do it yourself! If not, post the code you've so far and I'm very happy to help you again....
Can you translate the above to a module? that is what I am looking for. The other link " http://www.mikesdotnetting.com/Article.aspx?ArticleID=26 " you show is a great modular example
but they are not using the Gridview. I want to use the Gridview and the DataSource.
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!
kenbati
Member
234 Points
408 Posts
Re: The data is not updating the data; What am I doing wrong?
Dec 22, 2008 03:36 AM|LINK
thanks, for your help. Please see my code, I am trying to do the above in a module
Can you translate your code into c#, vb code? How do you add parameter command in the module? thanks
Our economy is bad due to corruption and monoply!
hans_v
All-Star
35986 Points
6550 Posts
Re: The data is not updating the data; What am I doing wrong?
Dec 22, 2008 09:07 AM|LINK
I think you won't learn anything if I would give you yet another example. You know the queries, you can see the parameters, again read this and you should be able to do it yourself! If not, post the code you've so far and I'm very happy to help you again....
kenbati
Member
234 Points
408 Posts
Re: The data is not updating the data; What am I doing wrong?
Dec 23, 2008 07:30 PM|LINK
good example, I will try it soon! thanks a lot
Our economy is bad due to corruption and monoply!
kenbati
Member
234 Points
408 Posts
Re: The data is not updating the data; What am I doing wrong?
Jan 15, 2009 03:21 AM|LINK
Can you translate the above to a module? that is what I am looking for. The other link " http://www.mikesdotnetting.com/Article.aspx?ArticleID=26 " you show is a great modular example but they are not using the Gridview. I want to use the Gridview and the DataSource.
thanks for your time
Our economy is bad due to corruption and monoply!