[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

using odbc in a connection of object

Posted on 2004-11-30
11
Medium Priority
?
149 Views
Last Modified: 2010-04-23
How do I assign a connection object to the odbc driver  I setup in control panel to get to the database.  I know how to assign the server, but in some case I need to use the ip address and in others just the server name, so I just rather setup a odbc driver and have the connection object look at that.

thanks
0
Comment
Question by:mgmhicks
9 Comments
 
LVL 33

Expert Comment

by:sajuks
ID: 12712993
Check http://www.connectionstrings.com/ to setup your odbc connections strings.
Eg:for mysql
SERVER=10.160.0.101 'assumeing thats your ip
DRIVER={MySQL ODBC 3.51 Driver};DESC=;DATABASE=MyDevlpm;SERVER=10.160.0.101;UID=xxx;PASSWORD=abc;PORT=;OPTION=0;STMT=;
0
 
LVL 27

Expert Comment

by:Dabas
ID: 12713062
Hi mgmhicks,
Use this as your connection string:

DSN=MyDSN;UID=user;DATABASE=MyDatabase;PWD=MyPassword;

Failing that, drag an ODBC connection from the Data in your toolbox to the form, rightclick on it go to properties, then manually set the connection.
Check the resulting connectionstring

Dabas
0
 
LVL 27

Expert Comment

by:Dabas
ID: 12713086
sajuks,
That is a good link you posted there! Thanks!

Dabas
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mgmhicks
ID: 12713350
Sorry guys that doesnt work.  Need to use a DSN connection in my oleconnection object.  Cant figure out the connection string.
0
 

Author Comment

by:mgmhicks
ID: 12713358
It actually took this connection string, but the data adapter configurator doesnt see the connection object on the form.

Provider=sqloledb;Data Source=TandA;Initial Catalog=timemanagment;Integrated Security=SSPI

How do I get a data adapter to use this connection know with the data adapter configurator

0
 
LVL 27

Expert Comment

by:Dabas
ID: 12713451
mgmhicks:
Try my connection (without provider = )
DSN=TandA;UID=user;DATABASE=timemanagment;PWD=MyPassword;

Dabas
0
 

Author Comment

by:mgmhicks
ID: 12713530
The following took care of the code.  However you must set a reference to odbc.net

        Dim cn As OdbcConnection
        cn = New OdbcConnection("dsn=TandA;uid=shicks;pwd=knicks19;")
        Dim mystring As String = "Select UserName,id from time_employees"
        Dim cmd As OdbcCommand = New OdbcCommand(mystring, cn)
        cn.Open()
0
 

Author Comment

by:mgmhicks
ID: 12975518
I ended up putting the correct answer in myself and wasnt sure how to close it after doing that.

0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12996019
PAQed with no points refunded (of 125)

modulo
Community Support Moderator
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month19 days, 11 hours left to enroll

872 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