<Columns>
<asp:BoundField HeaderText="Header you want to display" DataField="column name from your table" />
<asp:BoundField HeaderText="Header you want to display DataField ="column name from your table" />
</Columns>
<Columns>
<asp:BoundField HeaderText="Header you want to display" DataField="column name from your table" />
<asp:BoundField HeaderText="Header you want to display DataField ="column name from your table" />
</Columns>
</asp:GridView>
No, that's not the problem. The fields are autogenerated by default, so they are bound. The problem is the updatecommand:
kenbati
Member
234 Points
408 Posts
The data is not updating the data; What am I doing wrong?
Dec 10, 2008 02:02 AM|LINK
{
AccountDataSource.DataFile =
"~/App_Data/AccountInfo.mdb"; AccountDataSource.SelectCommand = " SELECT Scenario.* from Scenario ";AccountDataSource.UpdateCommand =
"UPDATE Scenario SET Scenario.BusinessStartYear = ?, Scenario.ReportingStart = ?, Scenario.ReportingEnd = ?, Scenario.FilterString = ? WHERE (Scenario.ScenarioID=Year2005) ";AccountDataSource.DeleteCommand =
"DELETE FROM [Scenario] WHERE (Scenario.ScenarioID=?) "; myGridView.ID = "myGridView";myGridView.DataSourceID =
"AccountDataSource"; myGridView.AutoGenerateColumns = true;myGridView.AllowPaging = true;myGridView.PageSize = 16;
myGridView.AllowSorting = true;myGridView.CellPadding = 3;
myGridView.CellSpacing = 1;
myGridView.AutoGenerateEditButton = true;myGridView.AutoGenerateSelectButton=
true;myGridView.SelectedIndex = 0;
myGridView.AlternatingRowStyle.BorderColor = System.Drawing.Color.BlanchedAlmond;myGridView.AlternatingRowStyle.BackColor = System.Drawing.Color.Bisque;}
</script><
asp:Content ID="Content1" runat="Server" ContentPlaceHolderID="ContentPlaceHolder1"> <div> <asp:AccessDataSource ID="AccountDataSource" runat="server"></asp:AccessDataSource> <asp:PlaceHolder ID="GridViewPlaceHolder" runat="Server"></asp:PlaceHolder> <asp:GridView onrowupdating="myGridView_RowUpdating" OnSelectedIndexChanged="myGridView_SelectedIndexChanged" ID="myGridView" runat="server" > </asp:GridView>
</div></
asp:Content>update gridview
Our economy is bad due to corruption and monoply!
deval
Member
68 Points
14 Posts
Re: The data is not updating the data; What am I doing wrong?
Dec 10, 2008 04:49 AM|LINK
<Columns> <asp:BoundField HeaderText="Header you want to display" DataField="column name from your table" /> <asp:BoundField HeaderText="Header you want to display DataField ="column name from your table" /> </Columns></asp:GridView>hans_v
All-Star
35986 Points
6550 Posts
Re: The data is not updating the data; What am I doing wrong?
Dec 10, 2008 05:01 AM|LINK
hans_v
All-Star
35986 Points
6550 Posts
Re: The data is not updating the data; What am I doing wrong?
Dec 10, 2008 05:04 AM|LINK
Oh,
And don't forget to provide values for the 4 parameters. Matbe you should read this
kenbati
Member
234 Points
408 Posts
Re: The data is not updating the data; What am I doing wrong?
Dec 10, 2008 03:01 PM|LINK
The quotes did not work. The problem is not resolved. Can you try the code on your vwd?
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 10, 2008 06:09 PM|LINK
The quoates are not the only issue! Like I said, I don't see where you provide the values for the parameters!
Again, read this, you probably don't need any code whatsover!
kenbati
Member
234 Points
408 Posts
Re: The data is not updating the data; What am I doing wrong?
Dec 17, 2008 12:00 AM|LINK
the fields are autogenerated
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?
Dec 20, 2008 03:37 PM|LINK
none of the solutions provided make technical sense. Can someone copy the code and try it on their computer. PLEASE
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 20, 2008 04:08 PM|LINK
Show the code you have so far (use the Source Code button in the editor!)
Do you get any error messages?
kenbati
Member
234 Points
408 Posts
Re: The data is not updating the data; What am I doing wrong?
Dec 20, 2008 04:55 PM|LINK
the code is on the thread. I do not get any errors
Our economy is bad due to corruption and monoply!