When I call this method from another class I get an exception:
public DataSet getDataSet(String storedProcedureName, params object[] values)
{
Database db = DatabaseFactory.CreateDatabase("myDSN");
return db.ExecuteDataSet(storedProcedureName, values); // This line fails
}
This is the error I get:
Parameter discovery is not supported for connections using GenericDatabase. You must specify the parameters explicitly, or configure the connection to use a type deriving from Database that supports parameter discovery.
But if I use this code and the stored procedure has no parameters it works:
public DataSet GetDataSet(CommandType commandType, string storedProcedureName)
{
Database db = DatabaseFactory.CreateDatabase("myDSN");
return db.ExecuteDataSet(commandType, storedProcedureName);
}
So, what should I do to make the first method work? I'm using visual studio community 2015, sql server 2008 R2 express, enterprise library 5 and .net framework 4.5.2 in my project.