ログインしたユーザーに基づいてレコードを表示するためにSqlDataSourceを使用しています。
<asp:SqlDataSource ID="ModifyCustomerDataSource" SelectCommand="SELECT cApplicationNo,cFirstName,cMiddleName,cLastName,nTelNo,nMobileNo,cPanGirNo from Data_Customer_Log where cAddedBy=@LoggedInUser" ConnectionString="<%$ ConnectionStrings:CwizDataConnectionString %>" runat="server"></asp:SqlDataSource>
そして、ページの読み込みで、次のようにパラメータを追加しています
protected void Page_Load(object sender, EventArgs e)
{
string user = HttpContext.Current.User.Identity.Name;
ModifyCustomerDataSource.SelectParameters.Clear();
ModifyCustomerDataSource.SelectParameters.Add("@LoggedInUser", user.Trim());
}
しかし、それは私にエラーを与えます
Must declare the scalar variable "@LoggedInUser".
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 "@LoggedInUser".
誰かが私がどこで間違っているのか指摘できますか?ありがとう