//调整使用占位符进行处理,时间:2017/9/29
string strql = @"select * from SYS_User where username=@username and userpwd=@userpwd ";
//创建连接对象
SqlConnection con = new SqlConnection(strco);
SqlDataAdapter da = new SqlDataAdapter(strql, con);
//命令
SqlCommand cmd = da.SelectCommand;
cmd.CommandType = CommandType.Text;
//sql传参的绑定
cmd.Parameters.Add(new SqlParameter("@username", txt_UserName.Text));
cmd.Parameters.Add(new SqlParameter("@userpwd", txt_Pwd.Text));
DataSet ds = new DataSet();
da.Fill(ds, "info");
DataTable dt = ds.Tables[0];