ストアド プロシージャとパラメーターを使用してプログラムで SqlDataSource をコーディングしようとしています。後で、この SqlDataSource をデータソースとしてリストボックスに割り当てたいと思いますが、ストアド プロシージャには指定されていないパラメーターが必要であるというエラーが表示されます。提供しているにもかかわらず、エラーが発生する理由がわかりません。
私が使用しているコードは次のとおりです。
sqlDS = new SqlDataSource();
sqlDS.ConnectionString = DC.ConnectionString;
sqlDS.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
sqlDS.SelectParameters.Add("@aPara_Name", TypeCode.String, aPara_Value);
sqlDS.SelectParameters[0].Direction = ParameterDirection.Input;
sqlDS.SelectCommand = "usp_StoredProcedure_1";
sqlDS.DataBind();
this.Controls.Add(sqlDS);
Listbox1.DataSource = sqlDS;
Listbox1.DataTextField = "Title";
Listbox1.DataValueField = "Value";
Listbox1.DataBind(); //this is where I get the error saying that stored procedure requires a parameter that wasn't passed!
誰かが私がどこで間違っているのか教えてもらえますか?