By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,337 Members | 1,323 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,337 IT Pros & Developers. It's quick & easy.

IDBDataInitialize.GetInitializationString

P: n/a
Imp
Hi,

i'm trying to get IDBDataInitialize.GetInitializationString working.
Initially i tried

[return:MarshalAs(UnmanagedType.LPWStr)]
string GetInitializationString(
[In, MarshalAs(UnmanagedType.Interface)] object pDataSource,
[In] byte fIncludePassword
);

Having successfully got the dialogue box with

object provider = null;
provider = promptInitialize.PromptDataSource(IntPtr.Zero, hwnd,
(Int32)
options, 0, IntPtr.Zero, IntPtr.Zero, ref IID_IDBInitialize);
and checked that 'provider' is not null i invoke

string conn = dataInitialise.GetInitializationString( provider, 0xFF
);

This gives me a null reference exception with the trace

Additional information: The parameter is incorrect.

Documentation tells me that E_INVALIDARG is returned if 'provider' or
the initialisation string
are null. So i converted to

[return:MarshalAs(UnmanagedType.LPWStr)]
string GetInitializationString(
[In, MarshalAs(UnmanagedType.Interface)] object
pDataSource,
[In] byte fIncludePassword,
[In, MarshalAs( UnmanagedType.LPWStr )] string
connectionString);

and invoked with

string dummy = "";
string conn = dataInitialise.GetInitializationString( provider, 0xFF,
dummy );

i got the same error.

(IIRC .NET interop doesn't support [In, Out]. Is that correct? If
not how do i use that?)

Anyone know how to get this working?

TIA,

imp.
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.