Database Guide

Level:
Level2

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 backends. 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 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

please help me

Hi Friends,
I develop one application project in visual basic. I don't know how to develop the code. please help me.
Thank you

please tell

please tell

Databases

I need to develop a program with a database and to which you can add data in excel sheets to the database from a thumb drive. Please help.

How to retrieve data using string

if you can retrieve data in a textbox like this

Set txtUsername.DataSource = rs 'where rs = ADODB.Recordset
txtID.DataField = "Username"

how can i retrieve data without any control? just using strings?

Search in Datagrid(vb 6.0)

Please!! Give a code of search in datagrid in vb 6.0
when you click search the ID and the info will appear in datagrid

All I know is when using

All I know is when using ADODC in connecting MS access put the adODC in the form with ur data grid connect it. In ur data grid property Recordsource the table that u want to appear in your datagrid will be there u just have to select it. and then right click ur data grid and select retrieve fields. So that the table in ur database will appear in the datagrid. LAst thing is putting the code Sample:

adoloan.recordsource=" Select * from qrybookloan where stud_ID= '" & txtsearch.text & "'"
adoloan.refresh

Set Datagrid.datasource.Update

Hope it helps u.

Can I just say what a relief

Can I just say what a relief to find someone who actually knows what theyre talking about on the internet. You definitely know how to bring an issue to light and make it important. More people need to read this and understand this side of the story. I cant believe youre not more popular because you definitely have the gift.
tempurpedic cloud luxe

Exporting to Excel

Hello..

..need some help..

How can i export my data from access to Excel using ADO data control?

..thnx..:)

send me a code that will

send me a code that will allow me to save and print from ms excel

hello Sir;

hi sir can you help in doing my project a enrollment system that can add, search,edit,delete or archiving..bless.
hope you can help me sir..thank you god bless:-)

Login That will apear to datagrid

To All Concerned Programmer,
Please help me to do this job username and password that will apear in my Datbagrid ...
tnx!! i dont know how to work with module...
please e-mail me @ jhonwendylsanchez@yahoo.com
tnx!!

Government Election System

Sir,
Please help creating a client server program that can be used in voting in our school..
The Server should be the one who can only be able to check the votes..
And the client should where they can vote using mysql.. Please.. help me.

Election System using MYSQL

Please contact me at my email address: butchpal@gmail.com and we will discuss the Elecction System

How to view oracle table data on vb6.0 data grid view

Please give me suggestion How to view oracle table data on vb6.0 data grid view. I need cordially help from you. I am trying but do not show accurately. So, please tell me what can I do for this situation. Thanks.

how can i set the print a specific record from access with vb

respecter sir

i want to know the set the print options

export many book excel for visual basic

Hello, hola, quiero exportar a muchos libros de excel, este codigo solo exporta a un solo libro, pero si deseo que sea por segmento, ejemplo: por zona, oficina. si es por zona que exporte x libros de excel donde cada libro tendra informacion oficina, nombre cliente, etc

help me please.

iam have is code

Private Sub exportar_Datagrid(Datagrid As Datagrid, n_Filas As Long)

On Error GoTo Error_Handler
Dim ObjExcel As Object
Dim i As Integer
Dim j As Integer

Me.MousePointer = vbHourglass

If n_Filas = 0 Then
MsgBox "No hay datos para exportar a excel. Se ha indicado 0 en el parámetro Filas ":
Exit Sub
Else
Set ObjExcel = CreateObject("Excel.Application")
ObjExcel.Workbooks.Add
ObjExcel.Sheets("Hoja1").Name = "Reporte Cartera"
' title
ObjExcel.ActiveSheet.Cells(1, 3) = "Report"
With ObjExcel.ActiveSheet.Cells(1, 3).Font
.Color = vbBlack
.Name = "arial"
.Size = 11
.Bold = True
End With

iCol = 0
For i = 0 To DataGrid1.Columns.Count - 1
If DataGrid1.Columns(i).Visible Then
iCol = iCol + 1
ObjExcel.ActiveSheet.Cells(4, iCol) = DataGrid1.Columns(i).Caption
For j = 3 To n_Filas - 1
ObjExcel.ActiveSheet.Cells(j + 2, iCol) = _
DataGrid1.Columns(i).CellValue(DataGrid1.GetBookmark(j))
Next
End If
Next

ObjExcel.Visible = True
ObjExcel.SheetsInNewWorkbook = 1

End If
Set ObjExcel = Nothing
Me.MousePointer = vbDefault

Exit Sub

' -- Error
Error_Handler:

MsgBox Err.Description, vbCritical
On Error Resume Next

End Sub

Request for help

how do i connect a table to individual record in the database. am using Adodc as my data control,

need help

Hi,, Master VB

I need help,, I create RFID for parking system,, I used Ms. access 2003 ,,, my database with VB is already connect using ADODC,,

MY PROBLEM IS ,,, how to display the image on VB,,

thanks,, cant wait for response

New in VBA from VFP6

I often confuse with vb codes. As VFP, a subroutine is always inactive whenever its called or a related object is excited. My program as follows in VBA:-

Dim conn As ADODB.Connection
Dim mytbl As ADODB.Recordset
Dim strsql As String
Dim cmd As ADODB.Command

Private Sub cbo1_Click()
wrong codes
End Sub

Private Sub Form_Load()
strsql = "cusp"
Call link2db
txtnm.Text = ""
End Sub

Private Sub link2db()
Set conn = New ADODB.Connection
Set mytbl = New ADODB.Recordset
conn.Provider = "Microsoft.jet.oledb.4.0"
conn.Open App.Path & "\busi97.mdb "
Call actcbo1
End Sub

Private Sub actcbo1()
mytbl.Open strsql, conn, adOpenDynamic, adLockPessimistic
x = mytbl.Fields(0)
cbo1.AddItem ("No Data Found")
If x = 0 Then
cbo1.Enabled = False
Else
cbo1.Clear
mytbl.MoveFirst
Do While Not mytbl.EOF
cbo1.AddItem (mytbl.Fields("names"))
mytbl.MoveNext
Loop
cbo1.Enabled = True
End If
cbo1.ListIndex = 0
End Sub

'When I run this form, it is giving error in cbo1_Click subroutine, since its not clicked.
'Thanks as advance.

Delete row DATAGRID

How i add a button in each row in a DataGrid? Or how I do to delete a selected row when i click them?

Database

Pls tel me how pass a value to parameter using vb 6.0 to excel
Dim strGarage As String
rsRec As New Recordset

With conn
.CursorLocation = adUseClient
.Provider = "Microsoft.ACE.OLEDB.12.0"
.ConnectionString = "Data Source=" & App.Path & "\a updated garageCheckoutScanningCompliance 9-1 through 9-9-22.xlsx;" & "Extended Properties=""Excel 8.0;HDR=Yes;"";"
'.ConnectionString = "Data Source=" & App.Path & "\Book1.xlsx;" & "Extended Properties=Excel 12.0;" "Extended Properties=""Excel 8.0;HDR=Yes;"";"
.Open
End With

rs.Open "Select * from [garageCheckoutScanningComplianc$A1:A68] ", conn, adOpenDynamic, adLockBatchOptimistic

when I open the record set how cn I use the Where clause to select the peticuler cell in Excell

Mini-Enrollment

Good day Sir,

I want to ask for a help regarding my database project, I'm using vb6 ang MySql database. How can I save a data from one table to another table in database using a datagrid of vb6? Can you give me some codes regarding on that problem?

Thank you! God Bless!

computer programming

help me to make my data base...please give me some codes..........tanx....

going bck to the basics

please help me i need to create a database where i can capture clients name for a company where they can enter the following details:
Surname
Full names
Identity Number
Email
Telephone Number
using vb 6.0

Creating database using Vb6

Hello,
Firstly, Create a database using below any of the two methods below,
There is one way of creating database using visual data manager in the Add Ins of visual basic 6.0 menus.

Another method Create a table using Microsoft Access and convert to access 97 using convert utility using access.

Now create a form in vb as to capture to datas of clients and using add and update buttons using database.
Then code to add and save, for any further real code send complete requirements of ur project.
and contact me through mail.

CodeMind

E-mail

My e-mail is: chrzgt7@hotmail.com.

Send me a message there or add me at MSN or Yahoo messenger so I can help you from there.

Looking forward for your reply.

ChrisGT7

opinion:)

this website is very helpful:)

i have many problems about

i have many problems about database,, can you please help me..

E-mail

Send me your problems at chrzgt7@hotmail.com in order to discuss them.

See you then.

ChrisGT7

how to create a table in oracle database from vb

how to create a table in oracle database from vb

SAVE AS in VB6

i am trying to write a code for a Visio file (with more than 1 flowsheets) to SAVE AS .jpg files for all flowsheets

Public Sub JPGCon()

Dim FS As String
Dim i As Integer
Dim vsoPages As Visio.Pages

Set vsoPages = ActiveDocument.Pages

For i = 1 To vsoPages.Count
FS = vsoPages.Item(intCounter).Name 'get the page name and assign to FS
Application.ActiveWindow.Page.Export (FS.jpg) 'assign the SAVE AS file with the FS name and extension as .jpg

Next i
End Sub

but somehow this code do not work and shows error at - Application.ActiveWindow.Page.Export (FS.jpg) .
I want to keep the variable name to .jpg to be created.
can anybody help me on this...

vb project not load on other pc

in my project use adodc connection with database file students.accdb
give me solution for that problem

Does the "other pc" has

Does the "other pc" has Access 2007 installed!?
.accd file format is exclusive for 2007 office package.

Radio Button in VB6.0

Hi all

I am new to VB6.0, can any one tell me the sample code to insert Radio Button (Yes / NO value) to MS Ascess Database
dalipb1980@gmail.com
Thanks

Please someon help me

Im programming for household book. I need to design log in form. In log in form I can't get what i should type for it.

Im not using VB.net Im just using MDB 7.0 and VB6

I have a register form which enables customer to register his/her Id and password

and in log in form it should check with database and decide log in - succed or fail.

And im coding date search i dont know how to do help me please

vb6

How can i add in database withou a duplicate record using vb6 and ms access..thanks

table fields dispaly in combobox(Database)

pls help me..

i want to access my table fields after adding it from combobox and display in combobox with the same name....

thank you,...

Help...

My e-mail and MSN is: chrzgt7@hotmail.com.

ChrisGT7

HELP.. high school enrollment system

i need help in making high school enrollment system using vb 6.0. please help me.. i need codes.. Enrollment system that can, add, edit, delete, view, search and print... i need it as soon as possible.. thanks so much

DataGrid in VB6/SQL Server

I am using msflexgrid in VB6/SQL server. I want to change msflexgrid to datagrid. Can some one mail me a sample programme using datagrid with vb6/sql server. Thanx in advance

vb6 & combo box

sir
how can i put all the names in my access field in a combobox in vb6?

Done!

SET Recordset = Connection.Execute("SELECT * FROM MyTable")

Combo1.Clear
While not Recordset.EOF
Combo1.AddItem Recordset!MyField
Recordset.MoveNext
Wend

Combo1.ListIndex = 0 'The first item of the combo box will be displayed

How to connect Access Database with VB

If any body can help to learn the following.
I have good knowledge of Microsoft Access and can write
VB code. I have written VB functions also. Have made Access application too.

1. How to connect Access Database with Visual Basic
2. How to make complete VB project and EXE apps

Connecting MS Access with Visual Basic 6.0 and making .exe file.

To connect MS Access with Visual Basic 6.0 :-
1. Create a file in MS Access (i.e. Project.mdb)
2. Create a table in this file,
3.Save,
4.Now close the MS Access.
5.Now go to control panel
6.Click on System and Security
7.Click on Administrative Tools
8.Double click on Data Source (ODBC) Administrator
The ODBC Data Source Administrator window will be appeared.In this window
9. Click on user DNS tab
The Create New Data Source window will be appeared. In this window,
10. Select Microsoft Access Driver (*.mdb)
11. Click on finish.
ODBC Microsoft Access Setup window will be appeared. In this window
12. Enter the name of Data Source Name in the Data Source Name box ( i.e. Project)
13. Click on Select button under Database.
14. Select the created MS Access file (i.e. Project.mdb)
15. Click Ok
16. Click Ok in ODBC Microsoft Access Setup window
17. Click OK in ODBC Data Source Administrator window.
18. Now open MS Visual Basic 6.0
19. Create a project
20. Now Go to Project menu
21. Click on components
22. In Controls tab tick ( click ) the Microsoft ADO Data Control 6.0 (OLEDB)
23. Click Ok.
24. Now draw the ADODC in the form.
25. Right click on the ADODC in the form
26. Click on ADODC Properties
27. In general tab click on Use ODBC Data Source Name
28. Select the Project (The Project is User DNS which is created by us in ODBC Data Source Administrator)
29. Now click on Record Source tab
30. Select adCmdTable in Command Type
31. Select the name of table ( i.e. enrollment) in Table or Stored Procedure Name
32. Click Ok
33. Now draw a textbox then attach the textbox with the datacontrol in the textbox properties.
To make .exe file:-
1. Go to file menu
2. Click make Project1.exe

need help

hey im lost on stem number 28, can you please elaborate what you mean when you say 'select the project"

Stem 28

In stem 28, the Project is a Data Source Name (DNS) which is created in ODBC Data Source Administrator window by clicking Add.... command button in User DNS tab and selecting Microsoft Access Driver (*.mdb) in Create New Data Source window and typing the "Project" in Data Source Name box in ODBC Text Setup window.
The Data Source Name (DNS) "Project" can be selected in ADODC Properties, by clicking Use ODBC Data Source Name option in General tab and then click on triangle symbol of combo box which is in the Use ODBC Data Source Name (DNS) option, then the list of Data Source Name (DNS) will be appeared, and then select the Data Source Name (DNS) "Project" from it.

Here enrollment is the name

Here enrollment is the name of table created in Project.mdb (ms access).

vb6

hi sir can you make a program for me.. about enrollment system using adodc.. and coonect to database

Ganyan din ang program na

Ganyan din ang program na ide-defense namin sa finaltem! enrollment system uding ADODC and ico-conect sa database. my SQL pa nga un.

Help...

If you need any help, add me at MSN or send me your questions here:
chrzgt7@hotmail.com

Waiting for your reply. See you!

send me some commands........

send me some commands........

Syntax for the SQL "LIKE"

hello,

I need some help in making a search code. Have trouble of getting the right codes for a search code. Have a code but it seems that it doesnt searches with the category "LIKE". it searches only if it find exactly the expression that I input in a text box. Which is not what I want. (Below is what is the code that I wrote)

ado1.RecordSource = "Select * from tblQuote where QrefNo Like '" & Text1.text & "'"

HELP plss!!! :)

Done!

Here is an example of code you are looking for:

Private Sub Text1_Change()
Adodc1.RecordSource = "SELECT * FROM tblQuote WHERE QrefNo LIKE '%" & Replace$(Text1.Text, "'", "''") & "%'"
Adodc1.Refresh
End Sub

The Replace function will help in avoiding a run-time error when the user types the character < ' >.

If you need any more help, send me at: chrzgt7@hotmail.com.

thanks dude your code works

thanks dude your code works for me..appreciate it

Hi, I have more log in User

Hi,
I have more log in User to my Database(Access2007)
and I want code can show User Name on report access.
Ex: 1- Mr Apple Log In on report show User Name Mr Apple.
2- Mrs Orage Log In on report show User Name Mrs Orage.
Please help.

E-mail...

Send me a message at chrzgt7@hotmail.com.

ChrisGT7

want codings

Sir. I need help.
How do I make a search engine using VB 6.0 and the database is MS Access.
For example:
I have the name, and when I click the command button (SEARCH)
the records of the name I type will be the only who will appear the same record wat we search in first time??

Please Sir.

do yall know hw to convert a

do yall know hw to convert a IFF data file into database access which is in mdb file format??

Patient Information Management & Billing System

Hi, please help me with a code to Register a patient in VB6

Thanks

Asking about vb6 using data form wizard

please I want u to send a code that I can use to search a customer using customer code number. I'm writing a project called computerazation of accounting records.
thanks for Ur help.

i need form design

i need form design about pay roll management and their particulars

Open Access data base from Shared PC by second PC

Hi.

My Main Data base File in Access 2003.File Extention is Filename.mdb(.mdb). My Shared pc ip is like 111.112.22.174. I want to access this file from my Second PC. its IP is like 111.112.22.184. My Data base file is in first PC in path is like "\\111.10.11.11\Reports\Filename.mdb"
I want to open that file from my VB6 Project.exe. By this exe i am entering data and run query in that ms access file. I can run all process by my first pc(111.112.22.174) but now I want to run same exe from my second PC(111.10.11.11). Exe is run properly but it can not run query or Process any thing in Data because database file is in First computer. So I want to access that file from my second PC so I can run query and other Process from any PC which is in My Network Lan.

Thanks
Jayesh

Kindly Assist Me...

Pls sir, i need your help in getting a "school Management code in vb".
i will be greatful if you can help me out.
i will be expecting to hear from you in my mail box.
thanks.

wrong code u telling us

Your coding is not useful for us. so don't misguide us..and if you are exactly help to students.. so pls. provide the full information regarding login form and accessing the database ...

about vb

Hello, what code you use the command using a data grid when it done it will find the data and have similar ... please help me

Need a help to convert text2mdb

Dear sir,

i have a text file like

name~ID~Address~phone~email
anik~0001~khilgao,Dhaka~51542151~abd@yahoo.com
Abid~0002~Polton,Dhaka~5545451~dfa@yahoo.com

i have also a table in blank access table in same format and field

Name,ID,Address,Phone,Email

Please help me by vb6.0 code for convert a text file (*.txt)to Access database (*.mdb)

Thanks/Br
Tareq

Sir

Sir. I need help.
How do I make a search engine using VB 6.0 and the database is MS Access.
For example:
I have the name, and when I click the command button (SEARCH)
the records of the name I type will be the only who will appear to the datagrid??

Please Sir. Heelp po
I am working as an OJT, and I have to do a program..
And thats the only thing, thats why I cant pass it yet.

Your solution

Reply me to this address by your own email i will send you the solution.

Re: Search Engine

It is very possible to make a search engine using vb 6.0 Access and DAO please email me and Wewill discuss the project. You can also give me a skype francisndungu or G-talk: francisndungu83@gmail.com

Vb & MS Access Coneectivity

Sir,
I have attached one VB File & MS Access Database file these to Files are to be connected.
I have only made the Forms and database
1. I want to enter data through VB and that data is stored in MS access. and also fetch data and show or print data
2. 1st form is Customer details and 2nd form is Customers Order details, and other is product detail form which we use to provide to the customers,
3. Search , Print, Save, EDIT. options should be there.
-------------
Sir, Please Do this for me.I will be very obiliged to you. at least one form with customer details should be get connect to the database. can u please send me by today or tomorrow.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options