C#读取数据库表字段名和值
string SqlText1 = "SELECT * FROM UserInfo"; SqlDataReader sReader = SqlHelper.ExecuteReader(SqlText1, SqlHelper.GetSqlConnection()); sReader.Read(); for (int i = 0; i < sReader.FieldCount; i++) { lbMsgField.Text += " " + sReader.GetName(i).ToString(); //获取字段名 lbMsgValue.Text += " " + sReader.GetValue(i).ToString(); //获取字段值 }