无法将类型“System.Data.SqlClient.SqlDataReader”隐式转换为“System.Data.DataSet”
publicDataSetGetScores(){SqlConnectionmyCon=newSqlConnection(ConfigurationManager.Con...
public DataSet GetScores()
{
SqlConnection myCon = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLSERVERCONNECTIONSTRING"].ConnectionString);
string cmdText = "SELECT Examinee.Username,Subject.Name,StartDate,Result,Login.ID "
+ "FROM Login INNER JOIN Examine ON Examinee.ID=Login.ExamineeID"
+ "ORDER BY SubjectID,StartDate DESC";
SqlCommand myCom = new SqlCommand(cmdText, myCon);
myCon.Open();
return (myCom.ExecuteReader(CommandBehavior.CloseConnection));
错误就在最后一句。 展开
{
SqlConnection myCon = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLSERVERCONNECTIONSTRING"].ConnectionString);
string cmdText = "SELECT Examinee.Username,Subject.Name,StartDate,Result,Login.ID "
+ "FROM Login INNER JOIN Examine ON Examinee.ID=Login.ExamineeID"
+ "ORDER BY SubjectID,StartDate DESC";
SqlCommand myCom = new SqlCommand(cmdText, myCon);
myCon.Open();
return (myCom.ExecuteReader(CommandBehavior.CloseConnection));
错误就在最后一句。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询