Using DllImport

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
 
M

Morten Wennevik

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
 
K

k

D'oh!!!!

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

Kirsty
 

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