0
私は検索を追加するアプリケーションを開発しています。私は自分のページでDataListを使用しており、これをフィルタリングしたいと考えています。私は私のしたが、空白のページは、私が検索ボタンをクリックしたときに表示されます。TextBoxとDropDownListを介したフィルタリングデータなし
protected void Button1_Click(object sender, EventArgs e)
{
string coom = ConfigurationManager.ConnectionStrings["COMM"].ConnectionString;
string q = "select * from Place where Name Like '%" + TextBox1.Text + "%' AND Comments Like '%" + DropDownList1.SelectedItem.Text + "%'";
SqlConnection connection = new SqlConnection(coom);
connection.Open();
SqlCommand cmd = new SqlCommand(q, connection);
cmd.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
DataList1.DataSource = ds;
DataList1.DataBind();
}
私は3時間詰まっていますが、どこに問題がないのですか。
助けてください!おかげ
デバッグして、クエリがデータを返すかどうかを確認しましたか? DataListをPage_Loadのデータソースにバインドしていますか? –
ありがとう#Chetan_Ranparya! –