Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC configuration

Status
Not open for further replies.

Strannik

Programmer
Jul 4, 2002
132
UA
Does anybody create DSN source in the source code? I use
SQLConfigDataSource ODBC function and it fails ((.

Here is the code:

UCHAR lpDriver[] = "SQL Server";
UCHAR lpAttr = "DSN=SQL_Base\0DATABASE=MyDB\0Server=MyServer\0" "uid=MyLogin\0pwd=MyPassword\0\0";

int iRes = SQLConfigDataSource(0, ODBC_ADD_SYS_DSN, _
lpDriver, lpAttr)

There' re absolutely no ideas about what's wrong. Because I use the same parameters which are stored in the registry if I create system DSN source using explorer.
 
Hi,

Do have any idea as to why this fails? I assume you've added odbcinst.h to the source and the odbcinst.lib type lib to your project and changed your linking to odbccp32.lib?

HTH
--

William
Software Engineer
ICQ No. 56047340
 
Sure, I've completely copied source code from ODBC manual page.
 
Have you got this to work yet? If not can you send me the source code please (william_AT_forensic-labs.co.uk) remembering to replace the _AT_ with @. :)

--
William
Software Engineer
ICQ No. 56047340
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top