DbCommandBuilder.DeriveParameters

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?
 
M

Miha Markic

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});
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top