Database Guide


This Visual Basic 6 guide walks you step by step through VB6 tutorials and VB6 source code on this site that will help you learn how to develop applications that store and retrieve data from database back ends. As you read each of these database tutorials you will gain more and more knowledge in how to handle databases in your VB apps. The best way to navigate through the guide is by using the links on the left. Or you can use the links below and then hit your browser's back button. Each link will take you to a different vb6 database tutorial on this site that will teach you the next step you need in order to become a VB6 database guru.

  1. To do anything of value in Visual Basic related to databases you will first need to learn how to write SQL statements to extract what you want from your back end database. This applies to not only Microsoft SQL server but also to Access and Oracle databases. Learn how with this Introduction to SQL (Structured Query Language)
  2. The data control in VB6 allows you to interact with your backend database with out having to write all the code by hand. This is great when you are first learning how to do database development in Visual Basic or for quick and simple VB6 database applications. For more complicated applications you will probably use ADO. Still check out this Database Access with the VB6 Data Control tutorial to start getting your feet wet.
  3. This tutorial is optional as DAO is a somewhat older way of Visual Basic database development. However, if you ever have to interact with older code its good to at least understand the basics of this. Check out the Using DAO (Data Access Objects) Code Tutorial
  4. Again, RDO is still not the newest (and best) way to access back end data. However, there is a lot of VB database code out there that uses RDO so its probably good to at least glance through this tutorial in order to know what to do if you ever work on and VB RDO project. Database Access with RDO (Remote Data Objects) in VB6
  5. This is a must read! Visual Basic ADO development is the newest (and best) way to interact with any database. After walking through this tutorial you should be able to have every tool in your belt to grab data, modify it, and write back to any database you come in contact with. Any VB6 database developer must read this Database Access With ADO in VB6 tutorial
  6. Once you understand all the basics of how to use ADO to work with a database you will probably want to display that data to your end user in some way. One very effective way of doing this is with the list view that is built into the VB6 IDE. Using ADO and the ListView control in VB6
  7. It is bad programming practices to write all your SQL statments directly into your Visual Basic source code. This makes it hard to change things down the road and also has a performance disadvantage compared to using stored procedures. Learn how all this works in this tutorial: Using ADO and stored procedures in VB6
  8. If you ever need to print of reports for end users you might want to consider using Crystal Reports. Although many times you can get away with writing your own reports or exporting things to Excel or Word at times this isn't an option. Check out this Using Crystal Reports with VB6 tutorial to learn more about how to create these for your end users.
  9. Optional: This is optional because unless you are having to interact with an Oracle database you will never need to know this information. However if there is a time you need to use Visual Basic and Oracle together I recommend you check out this
  10. If you enjoyed this post, subscribe for updates (it's free)

search engine

If Request.QueryString("search") <> "" Then

rowInfo.Text = ""

Dim search As String = Request.QueryString("search").Replace("'", "''")

Dim sqlstring As String = "select * from faq where question like '%" & search & "%' OR subjectHeader like '%" & search & "%' "

Dim search1 As Array = search.Split(" ")
If search1.Length > 1 Then
Dim i As Integer
For i = 0 To search1.Length - 1
sqlstring = sqlstring & "UNION SELECT * from FAQ Where question like '%" + search1(i).Replace("'", "''") + "%' or subjectHeader like '%" & search1(i).Replace("'", "''") & "%'"
End If

i have a search engine but it can only search by 1 word when i type more than 1 word, there will be an error,why? i need to allow user to be able to type more than 1

try and try untiL u find

try and try untiL u find it... like what i did... it works... =)


hi..we wanna know if vb6 is compatible with access 2003.




Just create your access 2003 and when you are throw, go toopen, select the database and click the arrow beside open, then select open exclusive. then go Tolls>convert and convert your database to access 97 format

help me for my project

i m doing project of dairy production management
but i don't know how to make it
if you have any project related this then pl send me
or guide me how to make my project
i m doing this project using simple vb 6.0 components

how to save data to sql 2005 specific table with vb6

i am completely new to programming, anyway, i created a form with text boxes and datagrid that users can input data. i have also created a database with 3 tables. now i want to make a save button that data can store in the correct table, how can i do this? i have managed to connect to the db with ADODB coding. thanks in advance.

saving data to a database

hi i urgently need your help. i have created a video library management system and i've connected to the DB but i don know the code on how to save new entries to the database. one of the forms have an optbox to display whether male or female. and also how to search for a record from a DB by inputting either the client name or the client id. pliiiiiz help urgently.

Private Sub

Private Sub cmdUpdate_Click()
data1.UpdateRecord `write controls to dynaset
End Sub
All you have to do is update the recordset using update Method. Your opt box in the database has to be yes or no type. See MSDN Library for more info.

search engine source code

can some1 tell me how to do the code for a search engine about student according gender,programme they taking,their hostel, do i do the codes by using vb6 anyway?
someone pls email to me because thats my assignment and i cant find any tutorial about a search engine so far..
and i reali duno wat to do anymore..with other SW.
if anyone know wat to do
pls email the guild to me aSaP thz...

How to write codes for a search button.Posted By OLURIN ADEYINKA

i need the coding for the search button in my application.When using Access database as your database.with ADOData control (ADODC)

How to write codes for a search button. By OLURIN ADEYINKA

i need the coding for the search button in my application.When using Access database as your database.with ADOData control (ADODC)

Listview using ADODC

i have a problem on how to use the listview in visual basic to view the record using the ADODC connection to MS access..
sir.. i really.. really.. need the code for that to finish my system.. just e mail me the complete code..

Thank you very much...


About your question? Use data grid to make it easy. Then data grid set properties to data source and select your adodc..tnx


hello everyone am from Kurdistan-hawler. I wanna know how can I connect the vb projects with asp or other servers for site desigings

Mail Me Now...........

What ever the question regardin vb6 your solution is just a mail away...
exchange code with me

image recognitation.....

Respected sir,
i am a engg college student. we are doing image recognition project in vb.we need source code for this project
thanking you

how to connect ms access2007 to vb6.0

how to connect ms access2007 to vb6.0
use datacontrol component

you can connect vb6 to

you can connect vb6 to access 2007 by simply following the steps in connecting vb6 to access 2003. that's it.

database connection with access 2007


Mail Me Now...........

What ever the question regardin vb6 your solution is just a mail away...

vb 6 list view with ms SQL

Can you expound on this vb6 database tutorial - I am trying to show my items in a table in ms SQL , to a list view how best can do it my table has 40 fields

pls help me

giv me programs 4 scientific calculator.......traffic signal using timer control

database problem

Hello, i was just wondering if you can help me on my project
I have created a database with 2 tables
1st table-original
2nd table-generated

How do i connect that database to VB. In my VB form, there will be 2 label for input purposes that will serve as input for those tables in dbase.

In other words, everthing that users type on the VB form will be transfered into DB. Thank you. Your help is very much appreciated

help help

sir i have to make a vb project of airline reservation in vb6. and i m not able to complete that project. becoz the coding is so you have any reservation project with full coding. if yes, then pppppppppllllllllssssssss send me sir on my email id

Connecting two different sql databases in vb6

Hi Im Shini,
I want da vb6 coding for how to connect 2 different sql databases in one program
plz sent me a coding , Thanks

comparing two tables

i'm using access database, i want how to connect dynamically to database and i have two 2 tables in database i want to compare 2 table from one database and put the selected recorded in dbgrid.

2.i want to compare 2 table from one database and put the selected recorded datarepoprts

pls send me complete code

>database connction

i have a problem on how to connect database to msgbox.... in visual basic programming

how to connect database to msgbox

just use string and manipute it in msgbox .. i mean string manipution... that it..


dim strId, strName, strAddress as string

call opendbcon
rs.opendatabase "select * from tbluser ", db, opendynamic, adoptimistic

do while not rs.eof
strId = rs("Id")
strName = rs("Name")
strAddress = rs("Address")

msgbox "Id:" & " " & strId & vbcrlf & "Name:" & " " & strName & vbcrlf & "Address" & " " & strAddress, vbinformation, "Title: My User "


exit sub


what is you reason? why you want to connect msgbox to the database?for what reason?

Accessing oracle 9i through Vb6.0

Hello Sir,
I am doing a project "visual-oracle". I have a problem in connecting the vb with oracle and accessing oracle through vb. In this project, we should able to create, delete, display and modify the table through vb (GUI)..

Please e-mail me the complete code for that.

A waiting eagerly to hear from you at the earliest.

Thanks in advance sir.

Best Regards,

Accessing oracle 9i through Vb6.0

I am doing a project "visual-oracle". I have a problem in connecting the vb with oracle and accessing oracle through vb. In this project, we should able to create, delete, display and modify the table through vb (GUI)..Please help me to do this project..


dfs* plz help for my Thesis Enrollment system I use ADODB but i dont understand how it work can any one plz help me My defence is on 3rd week of january hope any one can help me


How to Search in listviews


can you please tell me what SQL server are you using?what version?

Tool bar

i want you to send a coding how to use toolbar in vb 6.0

Crystal report

Please you to send me to connect crystal report and vb 6.0


program code for connectivity of sql server to vb 6.0 with cryst

program code for connectivity of sql server to vb 6.0 with crystal report

make casio in vb 6.0

Please send a coding to make the casio to me

in vb6.0 how to add guid to

in vb6.0 how to add guid to msacces plz hepl me

connectivity in with oracle sql server database

please guide me to connect oralcle database with by datagrid/pretty datagrid.
Thank you

Crystal Reports grrrr!!!

Hi everybody!!
I need to generate crystal reports without linking to database. I mean printing report values programitically. Pls help me out of this.

i nid tutorial in vb6 & msSQL 2005... help...

pls help me how to connect vb6 in msSQL 2005... and the control in listview.. tnx.... u can email me or contact me in ym... hir is my ym whiteboyzph.... tnx...

how to cennect vb6 to msSQL 2005?

can anyone help me? how can i connect vb6 to msSQL 2005? email me pls or add me in YM whiteboyzph is my ym.... tnx.....

Need a ADODB tutorial!!!!!!!!!!!!!!!!

sir, i have a project project is to create database of a school management system...i want to connect VB interface with Microsoft Access database using ADODB and i dont know how to do it...can u help me sir? sir, i relly need your help for me to graduate this semester...

connect first create


first create database

name your database firstMDB
then name your table myTable
then create fields, Name_ko,Last_ko

after you create database you can start coding in VB

create a connection on a module

Public connectFirstMDB As ADODB.Connection

Function load_data()
Set connectFirstMDB = New Connection
connectFirstMDB.Open "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:\foldercode\firstMDB.mdb"
End Function

then on a form

Public withevents rs_connect as ADODB.Recordset

Public Sub Form_Load()
on error goto err123 'in case an error occured
call load_data
set rs_connect = new recordset
rs_connect.Open "SELECT Name_ko,Last_ko from myTable",connectFirstMDB,adOpenStatic, adLockOptimistic
set datagrid1.datasource = rs_connect
exit sub
msgbox err.description
end sub

note: if your database contains nothing then error will occure telling "DATA ACCESS ERROR". just put at least 1 record.

i also have assignment

i also have assignment regarding withDBMS & data base approachs & file processing approaches. I search in th net but i found nonsense things... eerr wanna help me out here?

me too! i dunno iether

me too! i dunno iether

i can

give me your email i will give you example using adodb

vb6 Database Connection Method Step by step

Thnx for helping

for adodb example i need

hi, This is vijay.
I want to adodb examples. Pls send to my Email. ThankU

what your problem. i dont

what your problem. i dont care

i can giv u some code for

i can giv u some code for your project, ym me at

how to make a save button

how to make a save button that will display a msgbox when the field are incomplete...plz tnx....need dz today.. txtbck asap..^^


sir, i have a project project is to create database of a student information system...i want to use a list view and i dont know how to use it...can u help me sir? sir, i relly need your help for me to graduate this year...

Master detail

Hi... Could You please send me sample of master-detail (form-grid) program, which is explain how to handle the edited grid (detail) rows before commit on delete/save. Thank You.

DHTML Application in VB6.0

Can anyone tell me how do I connect Access database using DHTML Application in VB6.0? I realy need this information for my new project.

Please help me out......

what database you want to

what database you want to use? or you can import reference ADODB to your project.

Accessing Database

In accessing database, what happens if you open an existing file in output mode?
True or false: your form must contain a different data control for every table in the database.


hi sir,

i want to create a database file but the problem is i dont know how to begin....can you help me..?can you give me a step by step tutorial sir?



pls tell error reports.

pls tell error reports.

I need a code for search inside a database from VB

I built an application to access an access database in VB6 using data object, I need to create a search code in order to fasten finding a value in a name column of this database


HI SIR, how can i connects or links the sql database through visual basic 6.0 and how can i sort the names of the person that are listed in my record... tnxx

OpenOffice Database

I want to create a database using OpenOffice database with ADO. It is possible? I've already configure using ADO component but the problem is "invalid format" something like that.

ADODB Connection to Open office database

hi I have read your question regarding Connection string to open office database
I am also in search of help for this problem but could not resolve my problem
have you got any idea
please let me know

thanks & regards
Sharad ( India - Mumbai )

about open office dtbs prob 'invalid format'

You better use microsoft access 2003, that would solved the problems XD

visual basic 6 with database(record,save,delet) process

i want to create a database software with vb6.i need to help that how can i link MS Excel datasheet with my database.

doubts in vb

hi sir.
this is shravan kumar. some doubts are listed below
1. how can add records in the vb6 using access database

Read the ADO tutorial above.

Read the ADO tutorial above.

Client server

How to access database in server using vb6?