I'm creating a simple gridview and when I submit the update the threshold value doesn't update in the database. Before I was recieving a scalar variable error, then I added the update parameters and now nothing happens when submitted.
Any suggestions???
Here's the code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
<html xmlns=" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<span style="font-family: Tahoma">DOS UPDATE PAGE<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AutoGenerateEditButton="True"
CellPadding="4" DataSourceID="sqlDataSource" ForeColor="#333333" GridLines="None">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:BoundField DataField="ulname" HeaderText="Last Name" ReadOnly="True" SortExpression="ulname" />
<asp:BoundField DataField="threshold" HeaderText="Minutes" SortExpression="threshold" />
</Columns>
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
<asp:SqlDataSource ID="sqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ecwSQLConnectionString %>"
SelectCommand="SELECT [ulname], [threshold] FROM [P_resource_params]" UpdateCommand="UPDATE [P_resource_params] SET [threshold]=@threshold WHERE [ulname]=@ulname">
<UpdateParameters>
<asparameter Name="ulname" />
<asparameter Name="threshold" />
</UpdateParameters>
</asp:SqlDataSource>
</span>
</div>
</form>
</body>
</html>
Any suggestions???
Here's the code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
<html xmlns=" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<span style="font-family: Tahoma">DOS UPDATE PAGE<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AutoGenerateEditButton="True"
CellPadding="4" DataSourceID="sqlDataSource" ForeColor="#333333" GridLines="None">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:BoundField DataField="ulname" HeaderText="Last Name" ReadOnly="True" SortExpression="ulname" />
<asp:BoundField DataField="threshold" HeaderText="Minutes" SortExpression="threshold" />
</Columns>
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
<asp:SqlDataSource ID="sqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ecwSQLConnectionString %>"
SelectCommand="SELECT [ulname], [threshold] FROM [P_resource_params]" UpdateCommand="UPDATE [P_resource_params] SET [threshold]=@threshold WHERE [ulname]=@ulname">
<UpdateParameters>
<asparameter Name="ulname" />
<asparameter Name="threshold" />
</UpdateParameters>
</asp:SqlDataSource>
</span>
</div>
</form>
</body>
</html>