473,396 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

adding a MS Access ODBC DSN via SQLConfigDataSource

I am aware of the 'hack the registry' approach. This is just not a safe way to accomplish this on a user's PC. I need to do this the right way. Is there anyone -perhaps from Microsoft - out there who can assist me on this?

"Colin Stutley" wrote:
I now see your dilemma.

Not sure of the appropiate API calls, but an alternative may be to simple
add the appropiate registry entries for the DSN. I would try;
1) Export your registry to a disk file,
2) Create a new DSN with your desired properties via the control panel
applet,
3) Export your registry to a second disk file
Comparing the 2 export images should give you a snapshot of what registry
entries are being created, which you may then be able to insert via you .Net
app. Not "by the book" Im sure, but it may prove just as effective.

- Colin

"Lewt" wrote in message
Colin, thanks for your quick response. I know all about the OLE stuff.

Yes, it works great. Unfortunately, some of us don't have the liberty of
being able to utilize that.

I am creating a deployment project in which I do not have control over the

source code for the original application. Unfortunately, for me, this app
uses ODBC DSNs to connect to multiple access databases. This means that on
the target computer I need the ability to create those DSNs - since asking
the user to figure out the ODBC Administrator is way too much to ask of the
users these days.

Please pardon me if I'm laying it on thick, but I've been scowering the

Internet looking for this missing link (between C# & the .NET framework and
this MFC? SQLConfigDataSoure function), but all I can find is several people
asking and responses of alternative methodologies.

I know it can be done - there is a company out there who has done it and

is selling the code. Unfortunately, I paid them the money and they ave not
delivered the code - legal proceedings may be forthcoming. In the meantime,
does anyone know how to do this? Thanks!!

-Lewt

"Colin Stutley" wrote:
Have you looked at OLEDb rather than ODBC?
To get to your access database you could establish a connection via;
string vConStr = "Provider=Microsoft.Jet.OLEDB.4.0;"
+ "Data Source=C:\\Testdb.mdb;"
+ "User ID=Admin;Password=MyPassword;" // optional
+ "Jet OLEDB:Database Password=DevId"; //optional
System.Data.OleDb.OleDbConnection vDatabase = new OleDbConnection(vConStr); vDatabase.Open();
The ODBC and OLEDb methods are very similar from this point on.

OR

If you already have the MSAccess ODBC drivers installed you do not need to create a specific DSN for your individual connection. eg,
string vConStr = "Driver={Microsoft Access Driver (*.mdb)};"
+ "DBQ=C:\\Testdb.mdb;UID=;PWD=;";
System.Data.Odbc.OdbcConnection vDatabase = new OdbcConnection(vConStr);
- Colin.
"Lewt" wrote in message

> I am also interested in a detailed description of this... I have read
everything I can find on the SQLConfigDataSource function. Does anyone know how to implement this within C#.net - (i.e. add a MS Access DSN to System DSNs)? Thanks!
> -Lewt
>


Nov 16 '05 #1
0 4982

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
7
by: Comet Developer | last post by:
I would like to compress my Access database from within my VB6 Aplication I am writing. Anyone know how? Comet
0
by: Jacek Jurkowski | last post by:
Could someone tell me why "IntegratedSecurity" of that code works fine and else doesn't? if (this.IntegratedSecurity) { result = SQLConfigDataSource(System.IntPtr.Zero, 4, "SQL Server\0" ,...
1
by: Michael Meckelein | last post by:
Hi, My csharp application access a MS Access database through odbc connection. Is there a way to compact the Access database after deleting records using the odbc connection?
1
by: SBK | last post by:
I'm having trouble using VB.Net to create a system DSN. I cannot use DSN-less connection, must use ODBC. I have seen the "Creating odbc dsn with C#". I have seen many VB examples for creating an...
3
by: Tull Clancey | last post by:
Hi all. I've been searching all over the place for a bit of VB Net code that will create a DSN for an Access database. I've found examples of creating connections for SQL, but not Access. ...
4
by: zacks | last post by:
I have a DSN that I frequently have to change the default database. Is there a way to do this in VB.NET code instead of having to go through the setup wizard every time?
2
by: Dale Sampson | last post by:
My app uses an ODBC connection for a .mdb file. I want the app to create the source if it does not already exist (I copy a blank .mdb file to the users data store if it doesn't exist). I see how...
2
by: Steve | last post by:
I have zero experience with ODBC. If I have an Access frontend connected to a SQL Database using ODBC, are the tables connected like a frontend/backend Access database where the the tables you see...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.