Re: optional / Type.Missing



Hallo Ralph,

nein, das würde verursachen, das die optionalen
Werte *nicht* benutzt würden, sondern: "".

hupps...

ja, so ist das ;-)

mi.Invoke(null, new object[] { this.cboSQLServer.Text.Trim(), m, m, false }); --> Exeption: ... "Die nicht-statische Methode erfordert ein Ziel."

ja, das ist dann klar, ich ging von einer statische Methode aus,
denn Du hattes "loServer" gross geschrieben, was gemäss
den Namenskonventionen zum Beispiel eine Klasse ist.
(Schreibe lokale Variablen einfach CamelCase).

Für eine Instanz-Methode geht das zum Beispiel so:

Missing m = Missing.Value;
VbLib.IoServer server = new VbLib.IoServer();
MethodInfo mi = typeof(VbLib.IoServer).GetMethod("Connect");
mi.Invoke(server, new object[] {this.cboSQLServer.Text.Trim(), m, m, false });

oder eben auch - wie erwähnt:

MethodInfo mi = typeof(VbLib.IoServer).GetMethod("Connect");
ParameterInfo[] paras = mi.GetParameters();
new VbLib.IoServer().Connect(this.cboSQLServer.Text.Trim(),
paras[1].DefaultValue as string,
paras[2].DefaultValue as string, true);


ciao Frank
--
Dipl.Inf. Frank Dzaebel [MCP/MVP C#]
http://Dzaebel.NET

.



Relevant Pages

  • ssl win library and sspi example compiling questions
    ... I made a project for the server and for the client, ... error: missing ')' before 'string' ...
    (microsoft.public.platformsdk.security)
  • Re: Just Installed Exchange 2k3 cannot receive internet e-mail
    ... "Frank" wrote in message ... I cannot receive e-mail from the internet. ... > Currently the MX record is pointing to my exchange 5.5 server. ... > Am I missing a setting that I need to configure? ...
    (microsoft.public.exchange.setup)
  • SQL Connection Problem
    ... An error has occurred while establishing a connection to the server. ... database location within the applications App_Data directory. ... Boolean& failoverDemandDone, String host, String failoverPartner, String ... user, String password, Boolean trusted, String connectionString) +68 ...
    (microsoft.public.dotnet.framework.aspnet)
  • server-side JavaScript: Prototypes of built-in classes, objects and functins
    ... Session object (disk-based session variables for data persistence ... File class (manipulation of files on server, ie. open, close, read, ... //Methods Cgi.queryCgi.postCgi.anyby default return an empty string if requested var not found ...
    (comp.lang.javascript)
  • Re: App_data - ASPNETDB.MDF
    ... is only because I want my site work, without exception. ... Server Error in '/' Application. ... serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 ...
    (microsoft.public.dotnet.framework.aspnet)