Hi right no I have this method to execute the store procedure:
public static DataTable ExecuteProcedureNoParams(string connectionStringName, string procedureName)
{
using (DbCommand sprocCmd = SqlDB(connectionStringName).GetStoredProcCommand(procedureName))
{
DataTable dt = new DataTable();
using (IDataReader sprocReader = SqlDB(connectionStringName).ExecuteReader(sprocCmd))
{
dt.Load(sprocReader);
// DisplayRowValues(sprocReader);
}
return dt;
}
}
private static SqlDatabase sqlDB;
public static SqlDatabase SqlDB(string connectionString)
{
if (sqlDB == null)
{
sqlDB = CreateConnection(connectionString);
}
return sqlDB;
}
private static SqlDatabase CreateConnection(string connectionString)
{
DatabaseProviderFactory factory = new DatabaseProviderFactory();
if (string.IsNullOrWhiteSpace(connectionString))
{
// Create the default Database object from the factory.
// The actual concrete type is determined by the configuration settings.
return factory.CreateDefault() as SqlDatabase;
}
else
{
// Create a Database object from the factory using the connection string name.
return factory.Create(connectionString) as SqlDatabase;
}
}
Now, the error that i'm getting is that it cannot find my store procedure. I tested the connection String in the web config and it also working properly.
it fails in the IDataReader call.
could please anyone help me with this issue?
Aucun commentaire:
Enregistrer un commentaire