E
etam
Hi,
I am trying to build updateable GridView. I can't see the problem with
this code but it simply doesnt update the DataSet.
It doesnt work with or without
'OldValuesParameterFormatString="original_{0}"'.
It works updates data when UpdateCommand has "...WHERE (id = 1)", so I
think that problem is with @original_value, it is problably empty...
Do you know why?
<asp:GridView
ID="GridView1"
runat="server"
AutoGenerateColumns="False"
DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField
DataField="id"
HeaderText="id"
InsertVisible="False"
ReadOnly="True"
SortExpression="id" />
<asp:BoundField
DataField="topic"
HeaderText="topic"
SortExpression="topic" />
</Columns>
</asp:GridView>
<asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="<%$
ConnectionStringsrojectsConnectionString %>"
SelectCommand="SELECT id, topic FROM Projects"
UpdateCommand="UPDATE Projects SET topic = @topic WHERE
(id = @original_id)"
OldValuesParameterFormatString="original_{0}">
<UpdateParameters>
<asparameter Name="topic" Type="String" />
<asparameter Name="original_id" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
Thanks in advance,
Etam.
I am trying to build updateable GridView. I can't see the problem with
this code but it simply doesnt update the DataSet.
It doesnt work with or without
'OldValuesParameterFormatString="original_{0}"'.
It works updates data when UpdateCommand has "...WHERE (id = 1)", so I
think that problem is with @original_value, it is problably empty...
Do you know why?
<asp:GridView
ID="GridView1"
runat="server"
AutoGenerateColumns="False"
DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField
DataField="id"
HeaderText="id"
InsertVisible="False"
ReadOnly="True"
SortExpression="id" />
<asp:BoundField
DataField="topic"
HeaderText="topic"
SortExpression="topic" />
</Columns>
</asp:GridView>
<asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="<%$
ConnectionStringsrojectsConnectionString %>"
SelectCommand="SELECT id, topic FROM Projects"
UpdateCommand="UPDATE Projects SET topic = @topic WHERE
(id = @original_id)"
OldValuesParameterFormatString="original_{0}">
<UpdateParameters>
<asparameter Name="topic" Type="String" />
<asparameter Name="original_id" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
Thanks in advance,
Etam.