J
John Smith
It seems other people have had this problem, but none of the solutions
proposed fixes my situation. If someone could review the code below
and tell me what I'm missing. Thank you!
<asp:FormView id="LogText" DataKeyNames="LogID" runat="server"
DataSourceID="dsEdit" DefaultMode="Edit">
<EditItemTemplate>
<asp:TextBox id="editText" runat="server" Text='<%#
Bind("LogText") %>' rows="25" columns="120" TextMode="MultiLine" />
<asp:Button Text="Save" CommandName="Update"
runat="server" />
</EditItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="dsEdit" runat="server"
ConnectionString="Data Source=(local);Initial
Catalog=testDB;Integrated Security=True"
ProviderName="System.Data.SqlClient" SelectCommand="usp_admin_edit"
UpdateCommand="usp_admin_update" SelectCommandType="StoredProcedure"
UpdateCommandType="StoredProcedure"
OldValuesParameterFormatString="{0}">
<UpdateParameters>
<asparameter name="id" Type="Int32" />
<asp:ControlParameter name="strLog"
ControlID="LogText$editText" PropertyName="Text" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:QueryStringParameter DefaultValue="0" Name="id"
QueryStringField="LogID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
CREATE PROCEDURE [dbo].[usp_admin_update]
@id int,
@strLog text
AS
UPDATE tbl_Test
SET
LogText = @strLog
WHERE LogID = @id
proposed fixes my situation. If someone could review the code below
and tell me what I'm missing. Thank you!
<asp:FormView id="LogText" DataKeyNames="LogID" runat="server"
DataSourceID="dsEdit" DefaultMode="Edit">
<EditItemTemplate>
<asp:TextBox id="editText" runat="server" Text='<%#
Bind("LogText") %>' rows="25" columns="120" TextMode="MultiLine" />
<asp:Button Text="Save" CommandName="Update"
runat="server" />
</EditItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="dsEdit" runat="server"
ConnectionString="Data Source=(local);Initial
Catalog=testDB;Integrated Security=True"
ProviderName="System.Data.SqlClient" SelectCommand="usp_admin_edit"
UpdateCommand="usp_admin_update" SelectCommandType="StoredProcedure"
UpdateCommandType="StoredProcedure"
OldValuesParameterFormatString="{0}">
<UpdateParameters>
<asparameter name="id" Type="Int32" />
<asp:ControlParameter name="strLog"
ControlID="LogText$editText" PropertyName="Text" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:QueryStringParameter DefaultValue="0" Name="id"
QueryStringField="LogID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
CREATE PROCEDURE [dbo].[usp_admin_update]
@id int,
@strLog text
AS
UPDATE tbl_Test
SET
LogText = @strLog
WHERE LogID = @id