programmatically configuring the data source and driver

Posted on 1999-12-14
Medium Priority
Last Modified: 2013-11-20
How do we programmatically configure the datasource and associated driver.This can be manually done by clicking on the ODBC icon in the control panel.Since I'am using a CRecordset class,  in the "get default connect" function ,it goes to a predefined data source and if that data source is not registered in the system where the application is running , the program fails telling "data source not found "
Question by:vijayasham
LVL 23

Expert Comment

ID: 2282459
How to add a data source (ODBC)

Data Source: Programmatically Configuring an ODBC Data Source

TN048: Writing ODBC Setup and Administration Programs for MFC Database Applications

HOWTO: Configure ODBC Data Sources on the Fly

Author Comment

ID: 2282920
I had already tried using SQLConfig, but the problem is when I open the recordset ,it fails in in the get default connect function.
Any other answers please send to bmveena@hotmail.com.Thanx for the answers

Accepted Solution

inpras earned 40 total points
ID: 2283153
check this
str points to file to open
                  sprintf(szDesc,"DSN=%s; DESCRIPTION=Temp Data Source; DBQ=%s;FIL=MicrosoftAccess;",
            if (retVal =
//To configure data source dynamically
SQLConfigDataSource(NULL,ODBC_ADD_DSN,"Microsoft Access Driver (*.mdb)\0",
Hope this help

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Suggested Courses

601 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