string sql="select top 4 comtext order by comid desc";
SqlConnection connection = new SqlConnection("你的连接密码")
DataSet ds=new DataSet();
connection.open();
SqlDataAdapter command = new SqlDataAdapter(sql, connection);
command.Fill(ds);
string[] myStr=new string[ds.tables[0].rows.count];
for(int i=0;i<ds.tables[0].rows.count;i++)
{
mystr[i]=ds.tables[0].rows[i]["comtext"].tostring();
}
return mystr;
--------------
试一下,没环境,手写的。大小写等不对。就是按照comid排序而已,很简单的。
本文如未解决您的问题请添加抖音号:51dongshi(抖音搜索懂视),直接咨询即可。