?
Solved

programmatically configuring the data source and driver

Posted on 1999-12-14
3
Medium Priority
?
134 Views
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 "
0
Comment
Question by:vijayasham
3 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 2282459
How to add a data source (ODBC)
http://msdn.microsoft.com/library/sdkdoc/sql/6_odbcht_2.htm 

Data Source: Programmatically Configuring an ODBC Data Source
http://msdn.microsoft.com/library/devprods/vs6/visualc/vccore/_core_data_source.3a_.programmatically_configuring_an_odbc_data_source.htm 

TN048: Writing ODBC Setup and Administration Programs for MFC Database Applications
http://msdn.microsoft.com/library/devprods/vs6/visualc/vcmfc/_mfcnotes_tn048.htm 

HOWTO: Configure ODBC Data Sources on the Fly
http://support.microsoft.com/support/kb/articles/Q110/5/07.asp
0
 

Author Comment

by:vijayasham
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
0
 
LVL 4

Accepted Solution

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

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