Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 146
  • Last Modified:

VB & Connection to access database

by using the visual basic 6 and ADO , can i connect to access database file located in a site on the internet , if this possible , how can i do this

PS: i can make this conncetion using the ASP.Net , i tried to use the same method inside the VB but it doesnot work

Thanx
0
ashraf_t
Asked:
ashraf_t
  • 3
  • 2
1 Solution
 
OzWolfCommented:
First off, you need to create a system DSN entry in Windows that points to the database at it's correct location.

What you then need to do is use an ODBC connection to connect to the database.

An example connection might be:

----------------------------------------------------------

dim ODBCCon As ADODB.Connection
dim strCon as String

Set ODBCCon = New ADODB.Connection

strCon = "DSN=Internet_Access_DB; uid=admin; password=some_password; database=internet.mdb"

ODBCCon.Open strCon, "admin", "some_password"

----------------------------------------------------------

There you go.  This assumes that you have created an ODBC (System DSN) entry called Internet_Access_DB that points to the database internet.mdb.

Hope it helps.
0
 
ashraf_tAuthor Commented:
that is the problem , how to create this DSN file ?
0
 
OzWolfCommented:
Ok, go to the Control Panel -> Administrative Tools -> Data Sources.

Then click on the System DSN tab at the top.  Click the ADD button.  Select the Microsoft Access Driver option.

Okay, now comes the difficult bit.  You need to actually map the internet folder to your computer.  To do this, click on the SELECT button in the ODBC Microsoft Access Setup window.

From here, click the NETWORK button in the bottom right hand corner.  At the bottom of the new window should be a link saying: Create a shortcut to a Web folder or FTP site.

Click on this link and the Add Network Place Wizard will appear.  If you know the web URL of where the database lives, just type it in (ie. http://www.my-site.com).  It should connect.  You might have problems with something like Geocities, but I have successfully connected to a database on other servers this way.

Cheers,

OzWolf

0
 
ashraf_tAuthor Commented:
can u pls tell me one of the sites you had tested it , i prefer it free just for test ,
i tried to do what you said with my site but always get an error message the folder is invalid
0
 
OzWolfCommented:
I actually did it on a private site (based in another city) and it worked.  Some free sites actually block outside access via this method (and FTP) due to the possible bandwidth abuse that can occur.  However, look for free website hosts that allow FTP access and you should be able to use the above method to access the database.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now