I am having problems getting results from my datareader in visual studio 2008. I have several saved Procs in the same database. I can get values ββfrom those that do not receive input parameters. However, when I use the executreReader () method for a stored procedure with input parameters, I get an empty data directory. After examining the result collection, the message "IEnumerable does not return any results." I'm confusing since I can execute stored procs in sql server and return result sets. Previously, I could retrieve strings from these stored procedures in Visual Studio, but apparently it just stopped working one fine day.
I tried to use the dataadapter to populate the data set with my results and use the executereader () method to get sqldatareader, and yet I am not getting any results. No exceptions are thrown. My parameters are all named correctly, but I should be able to call these stored procedures without parameters and return an unfiltered result set. Currently Used Code:
string connStr = ConfigurationManager.ConnectionStrings["MyConnectionString"]
.ConnectionString;
SqlConnection connCactus = new SqlConnection(connStr);
SqlCommand cmdPopulateFilterDropDowns = new SqlCommand( "dbo.MyStoredProc",
connCactus);
SqlDataReader rdrFilterSearch = null;
cmdPopulateFilterDropDowns.CommandType = CommandType.StoredProcedure;
connCactus.Open();
rdrFilterSearch = cmdPopulateFilterDropDowns
.ExecuteReader(CommandBehavior.CloseConnection);
return (rdrFilterSearch);
Please, help!
source
share