グリッドビュー内の項目情報をデータベースから、名前を使用して表示したい、グリッドビューを別のページに表示したい 私はこのコードを試しましたが、それはあなたのクエリは私にオフになりますアイテムを名前で検索し、別のページにコンテンツを表示する
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=FATIMAH;Initial Catalog=makeup;Integrated Security=True");
string find = "select * from product where(name like '%' [email protected]+ '%')";
SqlCommand comm = new SqlCommand(find, con);
comm.Parameters.Add("@name", SqlDbType.NChar).Value = txt;
con.Open();
comm.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = comm;
DataSet ds = new DataSet();
da.Fill(ds, "name");
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
}