string sql = "select *from book where 编号='" + textBox1.Text+ "'";
this.sqlConnection1.Open();
DataTable dt = new DataTable();
this.sqlDataAdapter1 = new SqlDataAdapter(sql, this.sqlConnection1);
this.sqlDataAdapter1.Fill(dt);
dataGridView1.DataSource = dt;
this.sqlConnection1.Close();
看看这个例子吧
this.sqlConnection1.Open();
DataTable dt = new DataTable();
this.sqlDataAdapter1 = new SqlDataAdapter(sql, this.sqlConnection1);
this.sqlDataAdapter1.Fill(dt);
dataGridView1.DataSource = dt;
this.sqlConnection1.Close();
看看这个例子吧
不相信未作牺牲竟先可拥有,只相信靠双手找到我的欲求!!
我的博客:http://liao5930.blog.