HEREと記載されている検索可能なgridviewコードに従っています。 FilterExpression
の使用に問題があります。例外が発生した場合...「名前」演算子の後C#:SQL FilterExpression - 不足しているオペランド例外
オペランドがありませんが、「『スペンサー%』のような名前」
は、例外が次で発生し FilterExpression =:私は例外を取得しますコード:
protected void BindSGVData()
{
//hfSearchText has the search string returned from the grid.
if (hfSearchText.Value != "")
{
RidesSQL.FilterExpression = " WHERE " + hfSearchText.Value; //EXCEPTION HERE!
}
DataView dv = (DataView)RidesSQL.Select(new DataSourceSelectArguments());
//hfSort has the sort string returned from the grid.
if (hfSort.Value != "")
{
dv.Sort = hfSort.Value;
}
RideSGV.DataSource = dv;
try
{
RideSGV.DataBind();
}
catch (Exception exp)
{
//If databinding threw exception bcoz current page index is > than available page index
RideSGV.PageIndex = 0;
RideSGV.DataBind();
}
finally
{
//Select the first row returned
if (RideSGV.Rows.Count > 0)
RideSGV.SelectedIndex = 0;
}
}
あなたはどのようなデータベースを使用していますか? –
@ M.Babcockあなたは私のヒーローです! Lolは、ここにはっきりとしたことを理解しないことです...私はselectコマンドを編集してフィルタを追加するように変更しました。そして、それはどこにも必要ありません。私はあまりにもオペランドを修正することに気付いていました。私はあなたに大きな太った緑色のチェックマークを与えることができるので、答えを返せ! (: – SHeinema