Rows.Count 行
using (SqlCommand cmd = Common.SqlCommand(sSqlString))
{
cmd.Connection.Open();
SqlDataReader dr = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
sales_monthly_list.Load(dr);
dr.Close();
}
for (var i = 0; i < sales_monthly_list.Rows.Count; ++i)
{
DataRow s_fieldsvalue = sales_monthly_list.Rows[i];
}
列:
using (SqlCommand cmd = Common.SqlCommand(sSqlString))
{
cmd.Connection.Open();
SqlDataReader dr = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
while (dr.Read())
{
for (var i = 0; i < dr.FieldCount; ++i)
{
var name = (int)dr.GetName(i); //得到列名
var chn = dr[1];
var mgr = dr[2];
scriptpush_share += Common.cstrln("push([" + id + ", '" + chn + "',"+mgr+"]);");
}
}
dr.Close();
cmd.Connection.Close();
}