mgmhicks
asked on
using odbc in a connection of object
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
thanks
Hi mgmhicks,
Use this as your connection string:
DSN=MyDSN;UID=user;DATABAS E=MyDataba se;PWD=MyP assword;
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
Use this as your connection string:
DSN=MyDSN;UID=user;DATABAS
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
sajuks,
That is a good link you posted there! Thanks!
Dabas
That is a good link you posted there! Thanks!
Dabas
ASKER
Sorry guys that doesnt work. Need to use a DSN connection in my oleconnection object. Cant figure out the connection string.
ASKER
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;Inte grated Security=SSPI
How do I get a data adapter to use this connection know with the data adapter configurator
Provider=sqloledb;Data Source=TandA;Initial Catalog=timemanagment;Inte
How do I get a data adapter to use this connection know with the data adapter configurator
mgmhicks:
Try my connection (without provider = )
DSN=TandA;UID=user;DATABAS E=timemana gment;PWD= MyPassword ;
Dabas
Try my connection (without provider = )
DSN=TandA;UID=user;DATABAS
Dabas
ASKER
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=knick s19;")
Dim mystring As String = "Select UserName,id from time_employees"
Dim cmd As OdbcCommand = New OdbcCommand(mystring, cn)
cn.Open()
Dim cn As OdbcConnection
cn = New OdbcConnection("dsn=TandA;
Dim mystring As String = "Select UserName,id from time_employees"
Dim cmd As OdbcCommand = New OdbcCommand(mystring, cn)
cn.Open()
ASKER
I ended up putting the correct answer in myself and wasnt sure how to close it after doing that.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Eg:for mysql
SERVER=10.160.0.101 'assumeing thats your ip
DRIVER={MySQL ODBC 3.51 Driver};DESC=;DATABASE=MyD