问题描述
行70:行71://Executethecommand行72:myConnection.Open();行73:SqlDataReaderresult=myCommand.ExecuteReader(CommandBehavior.CloseConnection);行74publicSqlDataReaderGetProductCategories(){//CreateInstanceofConnectionandCommandObjectSqlConnectionmyConnection=newSqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);SqlCommandmyCommand=newSqlCommand("CMRC_ProductCategoryList",myConnection);//MarktheCommandasaSPROCmyCommand.CommandType=CommandType.StoredProcedure;//ExecutethecommandmyConnection.Open();(这里提示为初始化错误)SqlDataReaderresult=myCommand.ExecuteReader(CommandBehavior.CloseConnection);//Returnthedatareaderresultreturnresult;}怎么回事呢
解决方案
解决方案二:
打印ConfigurationSettings.AppSettings["ConnectionString"]);看什么
解决方案三:
问题自己解决。。key问题
时间: 2024-11-02 00:53:09