string strSql = "select * from 表名";
SqlConnection sqlConn = new SqlConnection(str);str = 连接数据库的字符串
sqlCommand sqlComm = new sqlCommand(strSql,sqlConn);strSql = sql语句
sqlDataAdapter sda = new sqlDataAdapter();
sqlDataSet ds = new sqlDataSet();
sda.SelectCommand = sqlComm;
sda.Fill(ds);
DataGrid1.DataSource = ds.Table[0].Rows[行索引][列索引].ToString().Trim();这样就可以获得具体某行某列里的值