how to register new DSN in ODBC Adminstrator ( using C# ) 
Author Message
 how to register new DSN in ODBC Adminstrator ( using C# )

Hello
    Could anybody say how to do it ? ( or where I can find some information
about it )

Regards
.//Seb.



Mon, 30 May 2005 21:08:48 GMT  
 how to register new DSN in ODBC Adminstrator ( using C# )
Hi,

You need to use SQLConfigDataSource and P/Invoke in .NET. In C#, the
prototype should be like:

[DllImport("ODBCCP32.DLL")]
public static extern int SQLConfigDataSource( int hwndParent, int fRequest,
string lpszDriver, string lpszAttributes);

For more information on P/Invoke, refer to MSDN:
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconconsumingun...
dllfunctions.asp

This posting is provided "AS IS" with no warranties, and confers no rights.

Regards,

Bill Cheng
Microsoft Support Engineer
--------------------

| Subject: how to register new DSN in ODBC Adminstrator ( using  C# )
| Date: Thu, 12 Dec 2002 14:08:48 +0100
| Lines: 10
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106

| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: cerber.zeto.lublin.pl 212.182.117.242
| Path: cpmsftngxa06!tkmsftngp01!TK2MSFTNGP09
| Xref: cpmsftngxa06 microsoft.public.dotnet.languages.csharp:115977
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Hello
|     Could anybody say how to do it ? ( or where I can find some
information
| about it )
|
| Regards
| .//Seb.
|
|
|
|
|



Thu, 02 Jun 2005 22:33:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Connecting to an MDB file thru ODBC *without* using DSN

2. DSN-Less ODBC using text drivers

3. Unable to open ODBC file dsn using OpenEx method

4. Connecting to an MDB file thru ODBC *without* using DSN

5. Can C# Apps Connect Using a DSN (DataSource)?

6. Can not register the new Database with ODBC

7. User DSN vs Sys DSN vs File DSN.

8. Using DAO to Register ODBC-Source

9. How do I register a DSN in code?

10. Creating new user accounts drom C++ (using ODBC or DAO)

11. ODBC New Records using AutoIncrement Fields

12. FYI: using ODBC bulk copy functions from C#

 

 
Powered by phpBB® Forum Software