CS0029: 无法将类型System.Data.SqlClient.SqlDataReader”隐式转换为System.Data.OleDb.OleDbDataReade
privatevoidDataLoadFlashnews(){intcount=0;stringsql="selecttop5*fromT_Productorderbyp...
private void DataLoadFlashnews()
{
int count = 0;
string sql = "select top 5 * from T_Product order by px desc,id desc";//数据库表表里面有下面的几个字段 还要有PX(是否放在前面播放)
OleDbDataReader read = DBFun.dataReader(sql);
while (read.Read())
{
if (count == 0)
{
count += 1;
flash_newstitle += read["ProductName"].ToString().Trim(); //数据库标题
flash_newsurl += read["url"].ToString().Trim(); //数据URL 也就是点击连接到的地址
flash_newspic += "newimg/" + read["ProductPic"].ToString().Trim();//数据库图片的URL
}
else
{
flash_newstitle += "|" + read["ProductName"].ToString().Trim();
flash_newsurl += "|" + read["url"].ToString().Trim(); ;
flash_newspic += "|newimg/" + read["ProductPic"].ToString().Trim();
}
}
read.Close();
DBFun.closeDataReader(ref read);
} 展开
{
int count = 0;
string sql = "select top 5 * from T_Product order by px desc,id desc";//数据库表表里面有下面的几个字段 还要有PX(是否放在前面播放)
OleDbDataReader read = DBFun.dataReader(sql);
while (read.Read())
{
if (count == 0)
{
count += 1;
flash_newstitle += read["ProductName"].ToString().Trim(); //数据库标题
flash_newsurl += read["url"].ToString().Trim(); //数据URL 也就是点击连接到的地址
flash_newspic += "newimg/" + read["ProductPic"].ToString().Trim();//数据库图片的URL
}
else
{
flash_newstitle += "|" + read["ProductName"].ToString().Trim();
flash_newsurl += "|" + read["url"].ToString().Trim(); ;
flash_newspic += "|newimg/" + read["ProductPic"].ToString().Trim();
}
}
read.Close();
DBFun.closeDataReader(ref read);
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询