473,411 Members | 1,894 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,411 software developers and data experts.

UpSizing Wizard and AUTO DNS ODBC Connection

How do I create and ODBC connection enbedded inside a link????

The upsizing wizard worked great however when it created the ODBC connection
somehow it enbeddeds the link and does not add to USER or SYSTEM DNS. Thats
cool. How can I do this by hand?

The advantage here is understanding how to create an ODBC on the fly with
out manually having a create a ODBC DNS connection within the control panel.

Thank you in advance for your help and Happy Easter!!

Mike
Apr 3 '07 #1
4 2513
Take a look at http://www.accessmvp.com/djsteele/DSNLessLinks.html for one
approach.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Michael Kintner" <no****@nospam.comwrote in message
news:13*************@corp.supernews.com...
How do I create and ODBC connection enbedded inside a link????

The upsizing wizard worked great however when it created the ODBC
connection somehow it enbeddeds the link and does not add to USER or
SYSTEM DNS. Thats cool. How can I do this by hand?

The advantage here is understanding how to create an ODBC on the fly with
out manually having a create a ODBC DNS connection within the control
panel.

Thank you in advance for your help and Happy Easter!!

Mike

Apr 3 '07 #2
Greetings,

Here is an API for creating a system DSN on your workstation to a Sql
Server

'--------------------------------------------------
Private Const REG_SZ = 1 'Constant for a string variable type.
Private Const HKEY_LOCAL_MACHINE = &H80000002

Private Declare Function RegCreateKey Lib "advapi32.dll" Alias _
"RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, _
phkResult As Long) As Long

Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias _
"RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As
String, _
ByVal Reserved As Long, ByVal dwType As Long, lpData As Any,
ByVal _
cbData As Long) As Long

Private Declare Function RegCloseKey Lib "advapi32.dll" _
(ByVal hKey As Long) As Long
Sub createSystemODBCdsn()
'Microsoft Knowledge Base Article - 184608
Dim DataSourceName As String
Dim DatabaseName As String
Dim Description As String
Dim DriverPath As String
Dim DriverName As String
Dim LastUser As String
Dim Regional As String
Dim Server As String

Dim lResult As Long
Dim hKeyHandle As Long

'--Specify the DSN parameters.

DataSourceName = "NameOfyourDSN"
DatabaseName = "databasetToConnectTo"
Description = "<a description of the new DSN>"
DriverPath = "C:\WINNT\System32\SQLSRV32.DLL"
LastUser = "SA"
Server = "YourServerNameHere"
DriverName = "SQL Server"

'--Create the new DSN key.

lResult = RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBC.INI\"
& _
DataSourceName, hKeyHandle)

'--Set the values of the new DSN key.

lResult = RegSetValueEx(hKeyHandle, "Database", 0&, REG_SZ, _
ByVal DatabaseName, Len(DatabaseName))
lResult = RegSetValueEx(hKeyHandle, "Description", 0&, REG_SZ, _
ByVal Description, Len(Description))
lResult = RegSetValueEx(hKeyHandle, "Driver", 0&, REG_SZ, _
ByVal DriverPath, Len(DriverPath))
lResult = RegSetValueEx(hKeyHandle, "LastUser", 0&, REG_SZ, _
ByVal LastUser, Len(LastUser))
lResult = RegSetValueEx(hKeyHandle, "Server", 0&, REG_SZ, _
ByVal Server, Len(Server))

'--Close the new DSN key.

lResult = RegCloseKey(hKeyHandle)

'--Open ODBC Data Sources key to list the new DSN in the ODBC
Manager.
'--Specify the new value.
'--Close the key.

lResult = RegCreateKey(HKEY_LOCAL_MACHINE, _
"SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources", hKeyHandle)
lResult = RegSetValueEx(hKeyHandle, DataSourceName, 0&, REG_SZ, _
ByVal DriverName, Len(DriverName))
lResult = RegCloseKey(hKeyHandle)

End Sub

'-----------------------------------------------------

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Apr 3 '07 #3
use Access Data Proejcts

all this MDB crap is unnecessary
On Apr 3, 10:25 am, "Michael Kintner" <nos...@nospam.comwrote:
How do I create and ODBC connection enbedded inside a link????

The upsizing wizard worked great however when it created the ODBC connection
somehow it enbeddeds the link and does not add to USER or SYSTEM DNS. Thats
cool. How can I do this by hand?

The advantage here is understanding how to create an ODBC on the fly with
out manually having a create a ODBC DNS connection within the control panel.

Thank you in advance for your help and Happy Easter!!

Mike

Apr 4 '07 #4
just use Access Data Projects

ODBC is obsolete
JET and DAO have been depecrated for a decade

"Michael Kintner" <no****@nospam.comwrote in message
news:13*************@corp.supernews.com...
How do I create and ODBC connection enbedded inside a link????

The upsizing wizard worked great however when it created the ODBC
connection
somehow it enbeddeds the link and does not add to USER or SYSTEM DNS.
Thats
cool. How can I do this by hand?

The advantage here is understanding how to create an ODBC on the fly with
out manually having a create a ODBC DNS connection within the control
panel.
>
Thank you in advance for your help and Happy Easter!!

Mike


May 2 '07 #5

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

Similar topics

1
by: Big Time | last post by:
I have an Access 2000 DB that I've been considering upsizing to SQL Server 2K. I'm wondering if anyone can share their experiences in upsizing and let me know of any tips or pratfalls. I've been...
0
by: Bon | last post by:
Hello All I got "Tables are skipped or export failed" error when I used upsizing wizard on migrating MS Access 2000 to MS SQL Server 2000. I am changing my application backend database from MS...
1
by: Calum Chisholm | last post by:
I'm looking to call the upsizing wizard from within a VBA function, preferably automating the entire upsizing process. Has anyone achieved this under Access 2003? The best I've managed so far is...
2
by: Big Time | last post by:
I have an Access 2000 DB that I've been considering upsizing to SQL Server 2K. I'm wondering if anyone can share their experiences in upsizing and let me know of any tips or pratfalls. I've been...
3
by: Dave Stone | last post by:
This question appeared years ago in the context of Acc2K and SQL Server 7, but no replies were posted. HOWEVER!! It still seems to be a problem with Acc XP and SQL Server 2000. Surely someone has a...
7
by: JM | last post by:
I'm using Access 2003 to attempt an upsize to SQL Server 2000. The Upsizing Wizard is giving me tons of problems with error messages like: 1. "Object is invalid. Extended properties not...
0
by: Carlo Stonebanks | last post by:
I would like my app to have its own run-time data connection wizard so that users can connect to a data source of their choice. I'm new to ADO.NET, previously programing for RDO/ODBC. With that, I...
16
by: Wayne | last post by:
Can anyone point me to any info on the pros and cons of upsizing small to medium size databases to SQL Server? If the user base is never going to be more than about 10, the app isn't totally...
3
by: Wayne | last post by:
I've just installed SQL Server 2005 Express together with SQL Management Studio Express on my local machine and I'm trying to upsize a data mdb to SQL Server using the upsizing wizard. The data...
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: 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
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,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.