代码分析
请帮忙分析一下这段代码,谢谢!protected void Btn_reaseach_Click(object sender, EventArgs e)
{//查询
//打开数据库连接
SqlConnection con = DB.CreateConn();
con.Open();
st_sqlstr = "select * from Teacher where Teacher_id='" + Tbx_teach_id.Text + "' or Teacher_name='" + Tbx_teach_name.Text + "'";
SqlDataAdapter st_da = new SqlDataAdapter();
st_da.SelectCommand = new SqlCommand(st_sqlstr, con);
DataSet st_ds = new DataSet();
st_da.Fill(st_ds, "temp");
//绑定到GridView数据源
Gv_teach.DataSource = st_ds.Tables["temp"].DefaultView;
Gv_teach.DataBind();
con.Close();
}