|
-
November 25th, 1999, 08:18 AM
#1
ODBC Connection
I need to know where is the error in following code for MS ACCESS connection through ODBC. Can I have the corrected code ?
private Sub Form_Load()
Dim PrivDb as Database
set PrivDb = OpenDatabase("", false, false, "ODBC;DSN=Hospital;UID=xxx;Pwd=xxx;")
End Sub
ODBC setting :
ODBC Driver = Microsoft Access Driver (*.mdb)
DSN = Hospital
Database = C:\Hospital
UID = xxx
PWD = xxx
Note : The above code is working if i change the driver to Sql Server
Thanks.
-
November 25th, 1999, 06:26 PM
#2
Re: ODBC Connection
Try to Change UID= to User ID= & PWD= to Pasword=
-
November 26th, 1999, 08:08 AM
#3
Re: ODBC Connection
There is a error in the openrecordset statement... iF you are using ADO then you just have to pass the database name and the dsn name
e.g.
dim objectname as new Connection
dim strconnect as string
strconnect = "Database=Hospital;dsn=dsnHospital"
objectname.open (strconnect)
-
November 27th, 1999, 02:54 AM
#4
Re: ODBC Connection
sunitha,
I used following with RDO.
Global Cn as rdoConnection
public Sub Main()
Dim Cnct as string
Cnct$ = "DSN=MS ACCESS;UID=santulan;PWD=beluz1;DATABASE=EOC.mdb;"
set Cn = rdoEnvironments(0).OpenConnection("", rdDriverNoPrompt, false, Cnct$)
This works :-)>.
In your project reference add RDO object before trying it.
Santulan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|