Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

Create a mdb database DSN with C...

Hello all,
I'd like to create DSN not by control panell (ODBC32) but programatically, is it possible?

I read something about a windows funciton:
ConfigDSN(...)
but I don't know how to use it, and which .h I have to include to use it. Any idea?

Thx
MARC
0
shoooot
Asked:
shoooot
1 Solution
 
makerpCommented:
yes,

SQLConfigDataSource(NULL,ODBC_ADD_DSN, "Excel Files (*.xls)",
                   "DSN=New Excel Data Source\0"
                   "Description=New Excel Data Source\0"
                   "FileType=Excel\0"
                   "DataDirectory=C:\\EXCELDIR\0"
                   "MaxScanRows=20\0");
0
 
jhanceCommented:
>>but I don't know how to use it, and which .h I have to include to use it. Any idea?


Have you ever heard of the MSDN Library?  It's in there.
0
 
shooootAuthor Commented:
Yes I know MSDN, but is no way to find which include needs the function that is displayed in the help at that time...
Or I didn't see it.

MARC
0
 
pagladasuCommented:
To use ::SQLConfigDataSource, you must include the ODBCINST.H header file and use the ODBCINST.LIB import library. Also, ODBCCP32.DLL must be in the path at run time (or ODBCINST.DLL for 16 bit).
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now