I need some help on how to go over this error below:
Server Error in '/' Application.
Must declare the scalar variable "@toDoDate".
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Must declare the scalar variable "@toDoDate".
aspx code:
<asp:SqlDataSource ID="todosrcsql" runat="server"
ConnectionString="<%$ ConnectionStrings:InstituteConnStr %>"
SelectCommand="SELECT [toDoDate], [toDo] FROM [ToDo] WHERE ([toDoDate] = @toDoDate)"
InsertCommand="INSERT INTO [ToDo] (toDoDate, toDo) Values (@toDoDate, @toDo)"
UpdateCommand="UPDATE [ToDo] SET toDo=@toDo WHERE toDoDate=@toDoDate"
DeleteCommand="DELETE [ToDo] WHERE toDoDate=@toDoDate">
<SelectParameters>
<asp:ControlParameter ControlID="Calendar1" DbType="DateTime" Name="date"
PropertyName="SelectedDate" />
</SelectParameters>
<InsertParameters>
<asp:ControlParameter ControlID="Calendar1" DbType="DateTime" Name="date"
PropertyName="SelectedDate" />
</InsertParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="calendarSrc" runat="server"
ConnectionString="<%$ ConnectionStrings:InstituteConnStr %>"
SelectCommand="SELECT toDoDate FROM ToDo">
</asp:SqlDataSource>
I don't know what went wrong. Please help. Thanks.
sheen_buhay
Member
711 Points
539 Posts
Must declare scalar variable
Mar 01, 2012 02:49 AM|LINK
Hi,
I need some help on how to go over this error below:
Server Error in '/' Application.
Must declare the scalar variable "@toDoDate".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Must declare the scalar variable "@toDoDate".
aspx code:
<asp:SqlDataSource ID="todosrcsql" runat="server"
ConnectionString="<%$ ConnectionStrings:InstituteConnStr %>"
SelectCommand="SELECT [toDoDate], [toDo] FROM [ToDo] WHERE ([toDoDate] = @toDoDate)"
InsertCommand="INSERT INTO [ToDo] (toDoDate, toDo) Values (@toDoDate, @toDo)"
UpdateCommand="UPDATE [ToDo] SET toDo=@toDo WHERE toDoDate=@toDoDate"
DeleteCommand="DELETE [ToDo] WHERE toDoDate=@toDoDate">
<SelectParameters>
<asp:ControlParameter ControlID="Calendar1" DbType="DateTime" Name="date"
PropertyName="SelectedDate" />
</SelectParameters>
<InsertParameters>
<asp:ControlParameter ControlID="Calendar1" DbType="DateTime" Name="date"
PropertyName="SelectedDate" />
</InsertParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="calendarSrc" runat="server"
ConnectionString="<%$ ConnectionStrings:InstituteConnStr %>"
SelectCommand="SELECT toDoDate FROM ToDo">
</asp:SqlDataSource>
I don't know what went wrong. Please help. Thanks.
SheenBuhay
MetalAsp.Net
All-Star
112032 Points
18231 Posts
Moderator
Re: Must declare scalar variable
Mar 01, 2012 02:55 AM|LINK
sheen_buhay
Member
711 Points
539 Posts
Re: Must declare scalar variable
Mar 01, 2012 03:03 AM|LINK
Thanks MetalAsp, it worked now.
SheenBuhay