|
-
Apr 16th, 2002, 04:50 AM
#1
Connect to an online database
Hello everybody. I'm trying to connect to a databse which is online. I tried the following code, but it doesn't work. Does anybody know the answer? Is it even possible to connect to an online database?
code:
Option Compare Database
Private strSQL As String
Private cnnData As New ADODB.Connection
Private rstData As ADODB.Recordset
Private Sub Form_Load()
With cnnData
.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=ftp://server/database.mdb;" & _
"Uid=xxxxxx;Pwd=xxxxxx"
.Open
End With
strSQL = "SELECT * FROM tblMembers"
With rstData
Set .ActiveConnection = cnnData
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open strSQL
End With
Set Me.Recordset = rstData
Me.txLName.ControlSource = "tx_LName"
End Sub
Thankx
-
Apr 16th, 2002, 05:36 AM
#2
Ok, I tried this link: http://www.able-consulting.com/ADO_Conn.htm (I saw it on a lot of threads ). I came to the conclusion that I need to connect to a remote machine using MS Remote or RDS since I don't want to use ASP. This is what (I guess) my code should look like. What I don't understand is that the database isn't specified anywhere??
oConn.Open "Provider=MS Remote;" & _
"Remote Server=http://myServerName;" & _
"Remote Provider=MSDASQL;" & _
"DSN=AdvWorks;" & _
"Uid=myUsername;" & _
"Pwd=myPassword;"
I'm not a champ in VB so if somebody could please help
-
Apr 16th, 2002, 06:02 AM
#3
"Remote Provider=MSDASQL;" & _
This specifies Sql server
"DSN=AdvWorks;" & _
This specifies a DSN which usually contains the database you wanna connect to
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Apr 16th, 2002, 06:22 AM
#4
-
Apr 16th, 2002, 07:09 AM
#5
-
Apr 16th, 2002, 07:13 AM
#6
Maybe I could have defined DSN better 
Here's a copy and paste:
Short for Data Source Name. Data Source Name provides connectivity to a database through an ODBC driver. The DSN contains database name, directory, database driver, UserID, password, and other information. Once you create a DSN for a particular database, you can use the DSN in an application to call information from the database.
There are three types of DSNs:
(1) System DSN -- can be used by anyone who has access to the machine. DSN info is stored in the registry.
(2) User DSN -- created for a specific user. Also stored in the registry.
(3) File DSN -- DSN info is stored in a text file with .DSN extension.
DSN is often used by Active Server Pages (ASP) and Visual Basic programs when a query to a database is necessary to retrieve information.
There is also what is known as a "DSN-less connection." Instead of using a DSN to connect to a database, the developer specifies the necessary information right in the application. With a DSN-less connection the developer is free to use connection standards other than ODBC, such as OLE DB.
-
Apr 16th, 2002, 07:27 AM
#7
-
Apr 16th, 2002, 03:35 PM
#8
-
Apr 17th, 2002, 01:51 AM
#9
I myself don't use DSN. I use DSN less.
but if you have an option there where you can specify the IP address, then DO that.
maybe something like
121.92.100.4/something/whatever.mdb
-
Apr 17th, 2002, 03:53 AM
#10
-
Apr 17th, 2002, 04:04 AM
#11
What makes you think that?
and... were you unable to find the proper connection string in that link?
I do not know what you have just posted. sorry.
-
Apr 17th, 2002, 04:15 AM
#12
Sorry, I didn't really get what you didn't understand in my last reply
-
Apr 17th, 2002, 04:32 AM
#13
DoCmd.TransferDatabase acLink, "Microsoft Access", _
"\\ip.adr.es.s\tables.mdb", acTable, "tblMembers", _
"tblMembers"
End Sub
-
Apr 17th, 2002, 04:39 AM
#14
First of all a little english mistake I made "address" (and not adress)
I looked in the VB help and found the "TransferDatabase Method" they gave this exemple:
DoCmd.TransferDatabase acImport, "Microsoft Access", _
"C:\My Documents\NWSales.mdb", acReport, "NW Sales for April", _
"Corporate Sales for April"
I thought this might also work for an online databse. You were talking about
were you unable to find the proper connection string in that link
?
-
Apr 17th, 2002, 05:35 AM
#15
The link i'm referring to is
http://www.able-consulting.com/ado_conn.htm
I don't know that method you've referred to... so.. it seems I'm unable to help you due to some sort of a confusion. I apologize for that. (btw, spelling don't matter!) (I don't work with DSN)
I suggest you click on New topic, and once again post the question from where you've left off. This way you can get more responses.
Good luck.
-
Apr 17th, 2002, 05:48 AM
#16
McFly... (hover boards coming??)
Are you just linking the tables from one mdb to another. Just that one mdb is online instead of on a network server/hd ?
The Docmd thing is a built in function of Access, which means you'd need the access references in there.
How are you connecting atm ?
- is it a linked table (surely thats so slow...) ? Can you link through the get external data ?
oConn.Open "Provider=MS Remote;Remote Server=http://myServerName;DSN=???;Uid=myUsername;Pwd=myPassword;"
I haven't used the remote connections, but perhaps RDO is better here than ADO ?? Worth a look ?
If the DSN can be saved from your computer, and yet still be flexible for other users this might be one way.
Go to the microsoft site, find a support email addy and send them the question - see what they recommend ?
If you have time, go to a book store or library n look up the RDO/remote connections/Net databases/Net programming... might have some use ful pointers there.
Good luck
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Apr 17th, 2002, 06:07 AM
#17
Yep, hover boards coming!! Back to the Future
Thanks for your advice, both of you.
CU
-
Apr 17th, 2002, 08:19 AM
#18
YW.
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
|