DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Visual Basic 4 / 5 / 6 (http://www.daniweb.com/forums/forum4.html)
-   -   How can i access data from MS Access using VB6 (I need the connection code) (http://www.daniweb.com/forums/thread83228.html)

guru511 Jul 11th, 2007 12:26 am
How can i access data from MS Access using VB6 (I need the connection code)
 
How can i access data from MS Access using VB6 (I need the connection code) can u plz tell me the code for accessing tables in MS Access using Visual Basic 6. my access tables are in a server not in my local computer..... plz let me know the code

QVeen72 Jul 11th, 2007 3:06 am
Re: How can i access data from MS Access using VB6 (I need the connection code)
 
Hi,

Get Connection String here:

http://www.connectionstrings.com/?carrier=access

Change the Path to Server Path.

Regards
Veena

choudhuryshouvi Jul 11th, 2007 3:06 am
Re: How can i access data from MS Access using VB6 (I need the connection code)
 
'using connection object

'in general section
dim conn as adodb.connection
dim rs as adodb.recordset

'in form load
set conn=new adodb.connection
set rs=new adodb.recordset

conn="provider=microsoft jet.4.0.oledb;data source=<ur database name>;persist security info=false"
conn.open
rs.open "select *from ur tablename",conn,adopendynamic,adlockoptimistic

guru511 Jul 11th, 2007 3:18 am
Re: How can i access data from MS Access using VB6 (I need the connection code)
 
will this work for a database which is in a server not in my local computer

guru511 Jul 11th, 2007 3:19 am
Re: How can i access data from MS Access using VB6 (I need the connection code)
 
thanq mr.choudhuryshouvi

will that work for a database which is in a server not in my local computer...

QVeen72 Jul 11th, 2007 3:29 am
Re: How can i access data from MS Access using VB6 (I need the connection code)
 
Hi,,

Add "Microsoft ActiveX objects 2.0" References to the project. Share the Folder in Server With Full Access.
use this code:


Dim rs As New ADODB.Recordset
Dim AC As New ADODB.Connection
With AC
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\ServerName\ShareFolder\db1.mdb;Persist Security Info=False"
.Open
End With
ssql = "Select * from MyTable"
Set rs=Nothing
RS.Open ssql,AC

REgards
Veena

guru511 Jul 11th, 2007 3:49 am
Re: How can i access data from MS Access using VB6 (I need the connection code)
 
Thanq very much veena
guru


All times are GMT -4. The time now is 3:47 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC