Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I am using enterprise library for mysql and asp.net. I'm getting this error:

"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."
public DataSet GetDataSet(string storedProcName, object[] values)
{
  // DataSet that will hold the returned results		
  DataSet _ds = null;
  try
  {
    // call the method to get the dataset from DB 
     _connection.Open();
    Object[] param = new Object[values.Length];
    for (int i = 0; i < values.Length; i++)
    {
      param[i] = values[i];
    }

    _ds = _db.ExecuteDataSet(storedProcName, param);// here it gives exception
    _connection.Close();
}

Please help me.
Posted
Updated 25-Nov-10 19:17pm
v3
Comments
JF2015 26-Nov-10 1:11am    
Edited to correct grammar, spelling and code formatting.
88Rocker 26-Nov-10 1:14am    
any one??? please reply ASAP...
JF2015 26-Nov-10 1:26am    
ok, please be a bit more patient - you don't really believe you will get an answer to your question in 15min, do you?

 
Share this answer
 
Comments
88Rocker 26-Nov-10 2:52am    
not much useful, but i solve it.
Dalek Dave 26-Nov-10 3:50am    
Not what he needed, but a good link.
i solved it did some other tweaks.
public DataSet GetDataSet(string storedProcName, string[] inParameters, object[] values)
       {
           // DataSet that will hold the returned results
           DataSet _ds = null;
           try
           {
               //Database db = DatabaseFactory.CreateDatabase();
               DbCommand dbCommand = _db.GetSqlStringCommand(storedProcName);
               dbCommand.CommandType = CommandType.StoredProcedure;
               // Create and add integer input parameter
               for (int index = 0; index < values.Length; index++)
               {
                   _db.AddInParameter(dbCommand, inParameters[index], GetDBType(values[index].GetType().ToString()), values[index]);
               }
               _ds = _db.ExecuteDataSet(dbCommand);
           }
           catch (Exception exDataSetExecution)
           {
               if (_connection.State == ConnectionState.Open)
                   _connection.Close();
               // exception occurs whule getting the dataset
               throw exDataSetExecution;
           }
           //returns the data set
           return _ds;
       }
 
Share this answer
 
v2
Comments
Dalek Dave 26-Nov-10 3:50am    
Always feels good when you solve something like that!
88Rocker 26-Nov-10 4:01am    
yeah, feeling relax, free from tension. spend 1 hr on it and at-last found alternate :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900