Using DllImport

  • Thread starter Thread starter k
  • Start date Start date
K

k

Hiya,

I'm hoping somebody can help me out here, I have searched for this
problem but had no joy in finding a solution.

I'm trying to use the DllImport attribute as follows:

[DLLImport("ODBCCP32.dll")]

I have "using System.Runtime.InteropServices;" at the top of my class
code. I still get a compilation error:

"The type or namespace name 'DLLImport' could not be found (are you
missing a using directive or an assembly reference?)"

I thought about adding the reference to the dll through Add Reference
dialog - but that too gives an error - it claims it's not a dll or not
COM!

Kirsty
 
Hi Kirsty,

Simple mistake, you are writing DLL when it should actually be Dll :)

[DllImport("ODBCCP32.dll")]

Hiya,

I'm hoping somebody can help me out here, I have searched for this
problem but had no joy in finding a solution.

I'm trying to use the DllImport attribute as follows:

[DLLImport("ODBCCP32.dll")]

I have "using System.Runtime.InteropServices;" at the top of my class
code. I still get a compilation error:

"The type or namespace name 'DLLImport' could not be found (are you
missing a using directive or an assembly reference?)"

I thought about adding the reference to the dll through Add Reference
dialog - but that too gives an error - it claims it's not a dll or not
COM!

Kirsty
 
D'oh!!!!

thanks a million Morten - I hadn't noticed that (I really thought I'd
typed it in as DllImport!)

Kirsty
 
Back
Top