求查询代码
我想按照姓名查询考勤,不知道怎么写代码啊,protected void Button1_Click(object sender, EventArgs e)
{
string str = ConfigurationSettings.AppSettings["dsn"];
SqlConnection cn = new SqlConnection(str);
cn.Open();
String mysql = "select * from kaoqin where uname=" +TextBox2.Text;
SqlDataAdapter da = new SqlDataAdapter(mysql, cn);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataBind();
cn.Close();
}
求各位高手教我怎么写,