473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Using DllImport

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
Nov 16 '05 #1
2 30903
Hi Kirsty,

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

[DllImport("ODBCCP32.dll")]

On 8 Feb 2005 03:13:03 -0800, k <du**@netcomuk.co.uk> wrote:
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


--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #2
k
D'oh!!!!

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

Kirsty

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Umesh | last post by:
Hi all I am trying to change the printer(like paper source ,etc) setting in C#. But i am unable to do it. I am not sure how to do it. should i have to use WIN API like Openprinter , getprinter ,...
2
by: rawCoder | last post by:
Hi All, I have a *.cer file, a public key of some one and I want to encrypt some thing using this public key. Can someone point me to a sample code for Encrypting some file using...
7
by: Vincent Nguyen | last post by:
Hi, Does anyone know how call Win32 native API GetTokenInformation() by using C#? Any sample code would be helpful. Thanks! Vincent
0
by: Jim dunn | last post by:
HI I am having problems with C# with regards to its compatibility with win32 API methods, I am trying to read from a windows CE comm port using C# and imported methods from coredll.dll, it seems...
10
by: Joe M | last post by:
I was wondering if someone could lend me a hand with a C# problem I am having I am trying to use the “setPrinter” api to change the duplex setting (under printing preferences on printer...
4
by: Mohammed Abdel-Razzak | last post by:
Dear sirs I want to know how can I shutdown or restart my computer using C# Also I want to know how can I open any windows program using C# (EX: opening the windows calculator from my...
0
by: Guy Mahieu | last post by:
Hi, I am trying to dynamically add menu items to external win32 applications from c# code. I have found some VB6 examples on the net that do just that, but when I rewrite them into c# they will...
0
by: baker_tony | last post by:
Hi, I thought I'd post my notes on how I went about accessing MFC C++ code in my web app after spending a day or more gathering information on how to do it. Please, let me know if you have a...
13
by: Javad | last post by:
Hello I know that I should get the information of windows internet connections by using "rasapi32.dll" library, and I also have some sample codes, but I can't make them work. My exact need is to...
10
by: =?Utf-8?B?TWF0dA==?= | last post by:
I am using the following code to connect to and download files from an ftp server, but the Symantec anti-virus software on some of my customers machines tells them that their computers are...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.