关键字变色!
关键字变色!
OleDbConnection adc = DB.CreateDb();
adc.Open();
OleDbCommand adccmd = new OleDbCommand("select * from shoplist where provins like '%" + this.TextBox1.Text + "%' or city like '%" + this.TextBox1.Text + "%' or linker like '%" + this.TextBox1.Text + "%' or phone like '%" + this.TextBox1.Text + "%' or faxmail like '%" + this.TextBox1.Text + "%' or address like '%" + this.TextBox1.Text + "%'", adc);
OleDbDataAdapter oda1 = new OleDbDataAdapter();
DataSet ds1 = new DataSet();
int y = Convert.ToInt32(adccmd.ExecuteScalar());
oda1.SelectCommand = adccmd;
oda1.Fill(ds1);
if (this.TextBox1.Text == "")
{
Response.Redirect("Default.aspx");
}
string tmp = this.TextBox1.Text;
for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
{
for (int j = 0; j < ds1.Tables[0].Columns.Count; j++)
{
ds1.Tables[0].Rows[i][j] = ds1.Tables[0].Rows[i][j].ToString().Replace(tmp, "<font color=red ><strong>" + tmp + "</strong></font>");
}
}
this.GridView1.DataSource = ds1.Tables[0];
this.GridView1.DataBind();
adc.Close();