Solved

Create a mdb database DSN with C...

Posted on 2002-03-04
5
262 Views
Last Modified: 2012-06-21
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
Comment
Question by:shoooot
5 Comments
 
LVL 10

Expert Comment

by:makerp
ID: 6838881
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
 
LVL 32

Expert Comment

by:jhance
ID: 6838975
>>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
 
LVL 32

Expert Comment

by:jhance
ID: 6838978
0
 

Author Comment

by:shoooot
ID: 6839093
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
 
LVL 4

Accepted Solution

by:
pagladasu earned 100 total points
ID: 6839432
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now