Solved

Create a mdb database DSN with C...

Posted on 2002-03-04
5
263 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

929 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

19 Experts available now in Live!

Get 1:1 Help Now