DbCommandBuilder.DeriveParameters

  • Thread starter Thread starter Ale
  • Start date Start date
A

Ale

Well the Provider-Independent Data Access is quite good in ADO .NET 2.0

My only problem with it and what makes it somehow useless is that
DbCommandBuilder does not have an implementation for DeriveParameters... Now
My code goes:

-------------

DbProviderFactory DbProvider =
DbProviderFactories.GetFactory("System.Data.SqlClient");

DbConnection dbConnectionObj = DbProvider.CreateConnection();

dbConnectionObj.ConnectionString = ConnectionString;

DbCommand dbCommandObj = DbProvider.CreateCommand();

dbCommandObj.Connection = dbConnectionObj;

dbCommandObj.CommandText = storedProcedureName;

dbCommandObj.CommandType = CommandType.StoredProcedure;

dbCommandObj.Connection.Open();

------------

Now I would like to add

DbCommandBuilder.DeriveParameters(dbCommandObj);

but the DbCommandBuilder does not have an implementation for
DeriveParameters

How can this be done? Is there something I'm missing?
 
Right now I am not sure why the DeriveParameters method is static but you
might try using reflection to get to it, something like this:
MethodInfo mi = cb.GetType().GetMethod("DeriveParameters",
BindingFlags.Public | BindingFlags.Static);
mi.Invoke(null, new object[] { dbCommandObj});
 
Back
Top