Hello,
I am trying to use late binding to call a COM object.
I am trying to call a 'GetTables' method on the object.
It's essentially a 'MetadataServic e' which is used to
return the names of tables which are in a specific
database.
the first parameter to GetTables is "in only" (it's a
short - constant which defines types/categories of tables
to look for)
the second parameter is "in/out" (i.e. ref - "array of
objects" used to return the tablenames found for the
specified tables)
What do I need to do in order to invoke this? with two
different types of parameters?
Here's what I have so far...
==== Code begin ====
.... other code here...
try
{
Type metadataservice ;
object[] parameter=new object[1];
object MDSvc;
//get a metadataservice object
metadataservice = Type.GetTypeFro mProgID
("GMService.Met adataService");
//create an instance of the metadataservice
MDSvc = Activator.Creat eInstance(metad ataservice);
//Set the parameter I want to set
parameter[0] = objConn;
//Set the Connection Property
metadataservice .InvokeMember(" Connection",
BindingFlags.Se tProperty, null, MDSvc, parameter);
object[] args = new object[2];
args[0] = MetadataTableCo nstants.gmmtAny Spatial;
//not sure what to put here (or if this is correct syntax)
args[1] = String.Empty;
//try to invoke the GetTables() method
metadataservice .InvokeMember(" GetTables",
BindingFlags.In vokeMethod, null, MDSvc, args);
==== Code end ====
I am trying to use late binding to call a COM object.
I am trying to call a 'GetTables' method on the object.
It's essentially a 'MetadataServic e' which is used to
return the names of tables which are in a specific
database.
the first parameter to GetTables is "in only" (it's a
short - constant which defines types/categories of tables
to look for)
the second parameter is "in/out" (i.e. ref - "array of
objects" used to return the tablenames found for the
specified tables)
What do I need to do in order to invoke this? with two
different types of parameters?
Here's what I have so far...
==== Code begin ====
.... other code here...
try
{
Type metadataservice ;
object[] parameter=new object[1];
object MDSvc;
//get a metadataservice object
metadataservice = Type.GetTypeFro mProgID
("GMService.Met adataService");
//create an instance of the metadataservice
MDSvc = Activator.Creat eInstance(metad ataservice);
//Set the parameter I want to set
parameter[0] = objConn;
//Set the Connection Property
metadataservice .InvokeMember(" Connection",
BindingFlags.Se tProperty, null, MDSvc, parameter);
object[] args = new object[2];
args[0] = MetadataTableCo nstants.gmmtAny Spatial;
//not sure what to put here (or if this is correct syntax)
args[1] = String.Empty;
//try to invoke the GetTables() method
metadataservice .InvokeMember(" GetTables",
BindingFlags.In vokeMethod, null, MDSvc, args);
==== Code end ====