提示:不存在此行/列的数据
此句出错:
strarr[i]=read["SoftName"].ToString();
事实上的数据库有这列数据,是不是语法上出了什么问题?
OleDbConnection con=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(ConfigurationSettings.AppSettings["con"]));
String str="Select top 10 SoftName from SoftInfo order by Hits DESC";
String[] strarr=new string[10];
String result="";
OleDbCommand cmd =new OleDbCommand(str,con);
con.Open();
OleDbDataReader read;
read=cmd.ExecuteReader();
int i;
for(i=0;i<10;i++)
{
strarr[i]=read["SoftName"].ToString();
result+=strarr[i]+"<br>";
}