c#获取数据库中的某行某列的数据
c#将数据库中的某行某列的数据显示在textBox.text
string sqlcon = "server=(local);User Id=sa;Pwd=;DataBase=printGY";
SqlConnection con = new SqlConnection(sqlcon);
string sqlStr = "select * from fkjhb";
con.Open();
SqlDataAdapter adapter = new SqlDataAdapter(sqlStr, con);
DataSet ds = new DataSet();
adapter.Fill(ds,"fkjhb");
textBox1.Text = ds.Tables["fkjhb"].Rows[0]["公司名称"].ToString(); //rows后面的是第几行第几列的数据.
SqlConnection con = new SqlConnection(sqlcon);
string sqlStr = "select * from fkjhb";
con.Open();
SqlDataAdapter adapter = new SqlDataAdapter(sqlStr, con);
DataSet ds = new DataSet();
adapter.Fill(ds,"fkjhb");
textBox1.Text = ds.Tables["fkjhb"].Rows[0]["公司名称"].ToString(); //rows后面的是第几行第几列的数据.