如何在C#里查询数据库里的内容啊!
我想在TXTID里输入一些ID来查找。大大们帮我看看啊! string id = txtID.Text;
if (id != "") AddSql = " ygid like '%" + id + "%'";
string strSQL = "server=127.0.0.1;uid=sa;pwd=;database=temper";
SqlConnection con = new SqlConnection(strSQL);
SqlDataAdapter sda = new SqlDataAdapter ("select * from table1 where '%" + AddSql + "%'",con);
DataSet ds = new DataSet();
sda.Fill(ds);
dataGridView1.DataSource = ds;