protected void btnsearch_Click(object sender, EventArgs e) { string txt = txtsearch1.Text; SqlDataSource dt = new SqlDataSource(); GrLichSu.DataSourceID = null; dt.ID = "SqlDataSource1212"; dt.ConnectionString = @"Data Source=ABTT-20190713MZ\SQLEXPRESS;Initial Catalog=NHAHANG19;Integrated Security=True"; dt.SelectCommand = "select * from HOA_DON where mahoadon like'%" + txt + "%' or ngaythang like '%" + txt + "%'where makh like '%" + txt + "'%"; GrLichSu.DataSource = dt; GrLichSu.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["User"] != null) { Label1.Text = email(); } else { Label1.Text = ""; } SqlDataSource dt = new SqlDataSource(); string mand = ""; mand = manguoidung(); GrLichSu.DataSourceID = null; dt.ID = "SqlDataSource121"; dt.ConnectionString = @"Data Source=ABTT-20190713MZ\SQLEXPRESS;Initial Catalog=NHAHANG19;Integrated Security=True"; dt.SelectCommand = "select * from HOA_DON where makh='" + mand + "'"; GrLichSu.DataSource = dt; GrLichSu.DataBind(); }