473,657 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create Access ODBC DSN ?

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.

Has anyone done this or acn anyone point me in the right direction?

Cheers,
Tull.
Jan 26 '06 #1
3 9476
They keywords should be documented in the help file of the ODBC Access
driver, but you can always create a DSN manually and then get the
keywords/values from the registry:

For system DSNs:

HKEY_LOCAL_MACH INE\SOFTWARE\OD BC\ODBC.INI

At minimum, the DSN for access requires the DBQ=myAccessFil e.mdb
keyword/value if I recall correctly.

Notice also that you can skip the creation of a DSN and use a DSN-less
connection, adding the "Driver={Micros oft Access Driver (*.mdb)"
keyword/value. Search the DSN-less concept in Google.
--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com

"Tull Clancey" <tu**********@b topenworld.com> escribió en el mensaje
news:dr******** **@nwrdmz01.dmz .ncs.ea.ibs-infra.bt.com...
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.

Has anyone done this or acn anyone point me in the right direction?

Cheers,
Tull.

Jan 26 '06 #2
On Thu, 26 Jan 2006 13:41:44 +0000 (UTC), "Tull Clancey" <tu**********@b topenworld.com> wrote:

¤ 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.
¤
¤ Has anyone done this or acn anyone point me in the right direction?

I don't really recommend that you use the MS Access ODBC driver (use Jet OLEDB instead), but the
below thread (my second post) should demonstrate how:

http://makeashorterlink.com/?F2555184B
Paul
~~~~
Microsoft MVP (Visual Basic)
Jan 26 '06 #3
' Declare this in your Declarations

Public Declare Auto Function SQLConfigDataSo urce Lib
"ODBCCP32.D LL" _
(ByVal hwndParent As Integer, ByVal fRequest As Integer, ByVal
lpszDriver As String, ByVal lpszAttributes As String) As Long

'
-----------------------------------------------------------------------------------
Private Sub ConfigureODBC

Dim sDriver = "Microsoft Access Driver (*.mdb)"
Dim sAttributes As New System.Text.Str ingBuilder
Const ODBC_ADD_SYS_DS N = 4
Dim intResult As Long

sAttributes.App end("DSN=My DSN Name")
sAttributes.App end(Chr(0))
sAttributes.App end("DBQ=")
sAttributes.App end(strDatabase Path)
sAttributes.App end("\MyDB.mdb" )
sAttributes.App end(Chr(0))
sAttributes.App end(Chr(0))

intResult = SQLConfigDataSo urce(0&, ODBC_ADD_SYS_DS N, sDriver,
sAttributes.ToS tring)

sAttributes = Nothing
end Sub

Jan 26 '06 #4

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

Similar topics

11
3750
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 2003 Server or ADO or ODBC issue, I am posting this on all of the three newsgroups. That's the setup: Windows 2003 Server with IIS and ASP.NET actiavted Access 2002 mdb file (and yes, proper rights are set on TMP paths and path,
49
14324
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The application is relatively big: around 200 tables, 200 forms and sub-forms, 150 queries and 150 repports, 5GB of data (SQL Server 2000), 40 users. I'm wondering what are the disadvantages of using Access as front-end? Other that it's not...
9
3547
by: Albretch | last post by:
.. I am trying to create a database in a MS Access DB via JDBC drivers. I have tried both sun.jdbc.odbc.JdbcOdbcDriver and ids.sql.IDSDriver From some reason both drivers Exceptions tell me 'Syntax error in CREATE TABLE statement' even though I am not creating a table, but a Database // - - - - - - - - - - - - sun.jdbc.odbc.JdbcOdbc aSQL=CREATE DATABASE dbtest; java.sql.SQLException:
7
8850
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
1
9412
by: Bruce Lawrence | last post by:
I know this works for Access 97. Not sure about other versions. This will create a DSN to a SQL server in your ODBC connections and then link a table of your choise from that SQL DB to the Access Database. You could modify it anyway you like. Such as passing variables to the values you have to change vs. manually typing them in. Microsoft uses a table to pass the data here... http://support.microsoft.com/kb/q159691/ I just changed...
4
3401
by: Paul | last post by:
Hi, I am developing a c# windows .NET application. The application is going to run on a standalone PC and use an access database. I have figured out that I will need to create a project and add it to the custom actions of the my setup project to create the database. How do I create the database and then add a table using C#? Also, should I use an odbc data adapter, which I usually use with Access and if so how do I register the new...
0
12040
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in '/CinemaBookingSystem' Application. -------------------------------------------------------------------------------- ERROR General error Unable to open registry key 'Temporary (volatile) Jet DSN for process
3
2930
by: hsalort | last post by:
Hi, My question es very simple: Can I create a ADP file in MS Access 97 for updating tables, views, functions and stores procedures for a SQL Server database in a remote server. I'm using Windows XP Pro. In MS Access 2003 this is very easy to do, but my client only have a MS Access 97 version.
0
1382
by: Greg Corradini | last post by:
Hello, Lately I've been using the mx.ODBC module to query Access (mdb) tables. For the life of me, I can't get the 'create table' sql command to work. I use this command in Oracle and I've seen other mx.ODBC users weave into their scripts for Access. But I still can't get this simple test run below to work (ignore the geoprocessor object for ArcGIS): #Import Python Standard Library Modules import win32com.client, sys, os, string, copy,...
0
8420
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8842
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8617
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7353
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.