- First of all you must create a reference in VB to Microsoft ActiveX Data Object 2.X library. Version 2.8 is the latest, so you it if you find it. If you don't have it, you can download it from http://www.microsoft.com/downloads/d...DisplayLang=en.
The most used ADODB objects are the Connection, Command, Parameter and Recordset.
The first thing you should do is to create a connection to the database. The Connenction object requires a connection string. The content of this string depends on which database you want to connect to. You can find the most common connection strings at http://www.connectionstrings.com/.
I'm not sure what database you are using, but let's assume it is an Access database. The connection string will then look something like this: "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;User Id=admin;Password=;"
When you have opened a connection you can use the Command or Recordset to execute SQL statements. That can be SELECT, DELETE, UPDATE, INSERT, CREATE TABLE, ALTER TABLE etc. etc.
The recordset object is usually used to retrieve data from tables or views/queries while the Command object is used to execute the rest of the SQL statements, but you can use the Command object to execute SELECT statements aswell. The Command object also support Parameters.
I have attached a little demo that opens a connection to an Access database and performs a search in the Users table. The search can be performed using a Recordset object or a Command object.