代码语言:javascript复制
string strsql = $"select name from 表名";
DataTable dt = base.GetDataTable(strsql);
string[] result = new string[dt.Rows.Count];
for (int i = 0; i < result.Length; i )
{
foreach (DataColumn item in dt.Columns)
{
result[i] = dt.Rows[i][item].ToString();
}
}
return result;
or
代码语言:javascript复制string strsql = $"select * from 表名";
DataTable dt = base.GetDataTable(strsql);
string[] result = new string[dt.Rows.Count];
for (int i = 0; i < result.Length; i )
{
foreach (DataColumn item in dt.Columns)
{
result[i] = dt.Rows[i]["name"].ToString();
}
}
return result;
我的博客即将同步至腾讯云 社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=3mcfkt8o4f408