B
Balu Herbert via .NET 247
(Type your message here)
Hi there,
I am experiencing an error when I try to use the above method inmy c# class which, is a cut down version of Microsoft Data AccesBlock for SQL Server. Here, my database is SQL server but I amusing oledb to connect to the database hence I modified MDAB forOleDb.
Please find the code snippet below:
private static OleDbParameter[]DiscoverSpParameterSet(OleDbConnection connection, stringspName, bool includeReturnValueParameter)
{
if( connection == null ) throw new ArgumentNullException("connection" );
if( spName == null || spName.Length == 0 ) throw newArgumentNullException( "spName" );
OleDbCommand cmd = new OleDbCommand(spName, connection);
cmd.CommandType = CommandType.StoredProcedure;
connection.Open();
OleDbCommandBuilder.DeriveParameters(cmd);
connection.Close();
if (!includeReturnValueParameter)
{
cmd.Parameters.RemoveAt(0);
}
OleDbParameter[] discoveredParameters = newOleDbParameter[cmd.Parameters.Count];
cmd.Parameters.CopyTo(discoveredParameters, 0);
// Init the parameters with a DBNull value
foreach (OleDbParameter discoveredParameter indiscoveredParameters)
{
discoveredParameter.Value = DBNull.Value;
}
return discoveredParameters;
}
Any thought on this...
Cheers,
B
Hi there,
I am experiencing an error when I try to use the above method inmy c# class which, is a cut down version of Microsoft Data AccesBlock for SQL Server. Here, my database is SQL server but I amusing oledb to connect to the database hence I modified MDAB forOleDb.
Please find the code snippet below:
private static OleDbParameter[]DiscoverSpParameterSet(OleDbConnection connection, stringspName, bool includeReturnValueParameter)
{
if( connection == null ) throw new ArgumentNullException("connection" );
if( spName == null || spName.Length == 0 ) throw newArgumentNullException( "spName" );
OleDbCommand cmd = new OleDbCommand(spName, connection);
cmd.CommandType = CommandType.StoredProcedure;
connection.Open();
OleDbCommandBuilder.DeriveParameters(cmd);
connection.Close();
if (!includeReturnValueParameter)
{
cmd.Parameters.RemoveAt(0);
}
OleDbParameter[] discoveredParameters = newOleDbParameter[cmd.Parameters.Count];
cmd.Parameters.CopyTo(discoveredParameters, 0);
// Init the parameters with a DBNull value
foreach (OleDbParameter discoveredParameter indiscoveredParameters)
{
discoveredParameter.Value = DBNull.Value;
}
return discoveredParameters;
}
Any thought on this...
Cheers,
B