Unix Technical Forum

Using SQLConfigDatasource/SQLInstallerError/etc - can't find documentation

This is a discussion on Using SQLConfigDatasource/SQLInstallerError/etc - can't find documentation within the MS SQL ODBC forums, part of the Microsoft SQL Server category; --> Hello, I'm using the functions exposed in ODBCCP32.dll via C# ([DLLImport ("ODBCCP32.dll")]), but am having trouble figuring out what ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > MS SQL ODBC

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 09:47 PM
Keith
 
Posts: n/a
Default Using SQLConfigDatasource/SQLInstallerError/etc - can't find documentation

Hello,

I'm using the functions exposed in ODBCCP32.dll via C# ([DLLImport
("ODBCCP32.dll")]), but am having trouble figuring out what the return/error
codes are. The .dll isn't COM so I can't just add a reference to it. The
docs provide the names of the codes (like ODBC_ERROR_REQUEST_FAILED) but I
can't find the actual VALUE of that error. I've tried looking for a header
file or another .dll where they might be defined but no luck.

Could someone point me in the right direction, ideally to where all of these
constants are defined? Not just the errors, for also the constants used as
parameters like ODBC_ADD_DSN?

Thanks!

Keith


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 09:50 PM
sbeu
 
Posts: n/a
Default Re: Using SQLConfigDatasource/SQLInstallerError/etc - can't find documentation


Hi
I've hardly managed to use the SQLConfigDataSource function in order to
create System or user DSNs
here is how I use it into Delphi:
first, import the function :
function SQLConfigDataSource (hwndParent : Integer; fRequest :
Longint;
lpszDriver : AnsiString;
lpszAttributes : AnsiString): Longint;stdcall;external
'ODBCCP32.DLL' name 'SQLConfigDataSource' ;
Second, the constants:
Const
ODBC_ADD_DSN = 1;
ODBC_CONFIG_DSN = 2;
ODBC_REMOVE_DSN = 3;
ODBC_ADD_SYS_DSN = 4;
vbAPINull = 0;
DriverSQLServer:AnsiString='SQL Server';
then you call it:
SQLConfigDataSource(vbApiNull,ODBC_ADD_SYS_DSN,Dri verSQLServer,StrAttributes);

Well... Now you may change DriverSQLServer string in order to use
another odbc driver.
According to the odbc driver you use, the string StrAttributes may
change. It contains the connection string to the database. Watch this
website: http://www.connectionstrings.com/
it contains the specific connection strings for almost every database.

Send me feedback!
boisseau.xavier__________000@gmail.commm

remove the _ and the 0 and the last m to reply to my email.
thank you

Keith wrote:
> *Hello,
>
> I'm using the functions exposed in ODBCCP32.dll via C# ([DLLImport
> ("ODBCCP32.dll")]), but am having trouble figuring out what the
> return/error
> codes are. The .dll isn't COM so I can't just add a reference to it.
> The
> docs provide the names of the codes (like ODBC_ERROR_REQUEST_FAILED)
> but I
> can't find the actual VALUE of that error. I've tried looking for a
> header
> file or another .dll where they might be defined but no luck.
>
> Could someone point me in the right direction, ideally to where all
> of these
> constants are defined? Not just the errors, for also the constants
> used as
> parameters like ODBC_ADD_DSN?
>
> Thanks!
>
> Keith *




--
sbeu
------------------------------------------------------------------------
Posted via http://www.mcse.ms
------------------------------------------------------------------------
View this thread: http://www.mcse.ms/message1702039.html

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:21 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com