Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Connecting to a data source using ADO and retrievi...
Author:
timyjimy
E-mail:
Click to e-mail author
Submitted:
1/26/2001
Version:
VB6
Compatibility:
VB6
Category:
ActiveX
Views:
12347
Connecting to a data source using ADO and retrieving the data.
Declarations:
Create a reference to 'Microsoft ActiveX Data Object 2.0 Library'
Code:
Option Explicit 'Declare the connection and recordset objects Dim cnData as Connection Dim rs as RecordSet 'Instantiate the objects Set cnData = New Connection Set rs = New RecordSet 'Set the connection string cnData.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=<
>" cnData.Open 'Code to test the connection If cnData.State = adStateOpen Then MsgBox "Connection good." 'Get data from the database connection rs.Open "<
>", cnData 'For testing purposes, write to debug window Debug.Print rs!<
> 'Make sure to close the connection and release cnData cnData.Close Set cnData = Nothing
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement