Visual Basic 6 ADO Visual Basic 6 obsoletes the previously used database access technology provided by Jet This provides a new one known as ADO or Active Data Objects This technology allows users to access data easily from many existing databases like Oracle or MS SQL Server ADO is quite simple and allows programmers to provide flexible database front ends
Connection Object This object represents an open connection to the data source This connection can be a local connection or can be across a network Key Properties and Methods Property Methods ConnectionString Close Provider Open ConnectionTimeout CommandTimeout CursorLocation Mode
Command Object A command object specifies a specific method you intend to execute on or against the data source accessed by an open connection Key Properties and Methods Property Methods Key Properties and Execute Methods CommandText CommandType
Recordset Object The RecordSet object represents a complete set of records from an underlying base table in the database RecordSet object references only one record at a time as the current record Key Properties and Methods Methods Property CursorLocation AddNew CursorType Close and Open EOF and BOF MoveNext Fields MoveFirst RecordCount MoveLast MovePrevious
Putting These altogether Define and open a Connection to a data source Decide what data you need from the data source and define Command objects that will retrieve this data. Retrieve the data you require by executing the command objects and manipulate the data using RecordSet objects.
Database Connectivity Steps Make a VB application that can be used to connect to database
From here copy connection string and click ok
Establish ConnectionDim con As New ADODB.ConnectionDim rs As New ADODB.RecordsetDim cmd As New ADODB.CommandPrivate Sub Form_Load()con.ConnectionString ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Documents and SettingsAdministratorDesktopEmployee.mdb"con.Openrs.Open "select * from employee", con, adOpenDynamic, adLockOptimisticcmd.ActiveConnection = con