Simple Example of Connecting Database Using Data Environment

Language

In this program you will learn how to connect to the database using Data Environment. This is one of the features of Visual Basic to easily connect to the database without hard coding. If you are familiar with MS Access you will most likely find it easy to deal with Data Environment. By using Data Environment you can easily drag fields from command object to your form. You can also create command based on stored procedures, tables, views, synonyms, and SQL statements. Another feature is how you relate child form from the parent form. This can be done by relating one or more Command objects together.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Comments

Submitted bybrayogreaton Wed, 11/25/2009 - 16:01

Hi i recently sent out a msg but i wasn't sure whether you got it. My request was that kindly assist me with the online hotel reservation and booking system using php,Mysql,html etc . i shall be grateful. ciao let me know ASAP

Hey jay i know ur kinda busy. during your free time pliz spare some time and bail me out. i shall be gratefull. by the way i find the hotel reservation system using vb 6.0 an excellent work you did. all the areas are covered. ciao
Submitted byAnonymous (not verified)on Sun, 11/29/2009 - 01:17

HELP ME PLEASE.. I WANT TO KNOW IF THERE IS A REGULAR EXPRESSION IN VB.NET. IF THERE IS, I WANT TO KNOW HOW TO USE IT.. THANK YOU VERY MUCH.. -bernadeth
Submitted byjhervy14on Mon, 11/30/2009 - 19:52

Sir meron ka po bang combo box kapag pumili ako sa combo box yung mga details niya lalabas sa datagrid? help nman po salamat

Sir Jay, Na send ko na po yung database nasa book ko na send eh hindi ko lam kung pano mag send sau eh. thanks for the time

I actually uploaded the project. Please take a look at this link: http://www.sourcecodester.com/tutorials/visual-basic-net/display-record-datagridview-based-combobox-selected-value.html. And please next time obey the rules. Write in English only. Thank you
Submitted byAnonymous (not verified)on Thu, 12/10/2009 - 13:38

I want to develop " School management system in visual basic" so i need some help from your side. Thank you
Submitted byAnonymous (not verified)on Thu, 12/17/2009 - 13:48

sir do you have a codes of custom system!!! we need it tomorrow. thankz in advance............!
Submitted byameeron Fri, 12/18/2009 - 00:40

help me please i have program in vb6 for raw material i need code for date when i write this day's date the report show me stock out from the begening until today and also stock in and stock now, because my program does not show me the total it's show the stock out , stock in and balance for the date that i write it only please help me for that and thank you very mutch amer [email protected] yemen

hi there... i am a visual foxpro programmer, i wanna learn some techniques in programming visual basic 6.0. can you send me a simple program regarding payroll system written in vb6.0? thanks and more power to your blogs. [email protected]

Dim obj, rs As ADODB.Recordset, sql As String Set rs = New ADODB.Recordset If Ddate.Value "" Then sql = "SELECT * FROM store ORDER BY [ProductID]" _ End If rs.Open sql, cn, adOpenStatic If Not rs.EOF Then 'Set DataReport1.DataSource = rs.DataSource Set DataReport2.DataSource = rs.DataSource For Each obj In DataReport2.Sections("Detail").Controls If TypeOf obj Is RptTextBox Then obj.DataMember = rs.DataMember End If Next DataReport2.Sections("Detail").Controls("Text1").DataField = "DateAlias" DataReport2.Sections("Detail").Controls("Text2").DataField = "ProductID" DataReport2.Sections("Detail").Controls("Text3").DataField = "ProductName" DataReport2.Sections("Detail").Controls("Text4").DataField = "TotalQty" DataReport2.Sections("Detail").Controls("Text5").DataField = "TotalQty_SO" 'DataReport1.Sections("Detail").Controls("Text6").DataField = "tot1" 'DataReport1.Sections("Detail").Controls("Text7").DataField = "TotalQty_SR" DataReport2.Sections("Detail").Controls("Text8").DataField = "Balance" 'DataReport1.Refresh 'DataReport1.Show 'Set rs = Nothing DataReport2.Show vbModal End If End Sub sorry for dely reply up is the but i need when i select date in Ddate ineed in report to colcolate the stock out field from begening 2010 to that date i select it and other field also like stock in and balance can you please help me and send me as soon as possible thanks alooooooooooooooooooooooot amer yemen

dear admin can you please help me about this subject i sent the code and this problem can select fanction solve it can you make it please and send it to me i am very hurry about this p.s. i need colcolate stock out and stock in from date to date which i select it in pick1 and pick2 for example . thanks alot ameer
Submitted byAnonymous (not verified)on Sun, 12/27/2009 - 15:07

Thanks
Submitted byAnonymous (not verified)on Sun, 01/10/2010 - 22:03

i need the code which make to me the stock out and in from date to date otherwise that colcolat the stock from the date and to date i write it in pick thanks ameer
Submitted byAnonymous (not verified)on Tue, 01/12/2010 - 22:52

Any source code for an Electricity Billing System using Visual Basic with a Ms Access Database?
Submitted byAnonymous (not verified)on Wed, 01/13/2010 - 23:09

please help me in my software project,,i cant do this program,.. the amplitude exam..vb6 with 2003 access.please sir help me..sir email me [email protected] you
Submitted byAnonymous (not verified)on Fri, 01/22/2010 - 16:10

Hi sir jay can you please help me with a call login system i've been trying the whole month and i still can't the windows application to communicate with the database on visual studio. my email is [email protected]. thanx in advance
Submitted byAnonymous (not verified)on Mon, 01/25/2010 - 14:57

hi i have made this program and im facing a problem in the search button im using VB6 and data environment with access 2003 i need to search by first name only or sirname from the whole name plz plz help here the code : Private Sub Command2_Click() y = InputBox(" enter the name plz ") If y = vbCancel Then Exit Sub ElseIf DataEnvironment1.rsCommand1.RecordCount = 0 Then MsgBox ("no data") ElseIf y "" Then DataEnvironment1.rsCommand1.MoveFirst DataEnvironment1.rsCommand1.Find "Name = '" & y & " ' " On Error GoTo picer x = "c:\pix\" + Text1.Text + ".jpg" Image3.Picture = LoadPicture(x) picer: Exit Sub If DataEnvironment1.rsCommand1.EOF Then MsgBox ("not registed") DataEnvironment1.rsCommand1.MoveFirst End If End If End Sub
Submitted byAnonymous (not verified)on Wed, 02/24/2010 - 10:39

how to put edit?
Submitted byAnonymous (not verified)on Sat, 03/13/2010 - 18:19

i need the simple data base connection coding for VB with oracle data base and i need the explanations also can u send me that in my id [email protected] thanks jay
Submitted byAnonymous (not verified)on Thu, 05/06/2010 - 15:10

HI SIR I JUST WANNA ASK HOW TO CONNECT COMBO BOX IN DATA REPORT.. I HAVE A PROBLEM HERE THAT MY COMBO BOX WHICH IS IN OTHER FORM CANNOT CHANGE THE SQL STATEMENT THAT IS ON MY DATA ENVIRONMENT.. THE SITUATION IS THAT I HAVE A FORM WHICH HAS RECORDS OF COMPUTER COMPONENTS REGARDING WHAT LOCATION WERE ARE THEY ... EXAMPLE THE LOCATION IS IN ROOM 401, IT SHOULD CHANGE THE SQL STATEMENT INTO "SELECT * FROM INVENTORY WHERE LOCATION = "ROOM 401" SO THAT WHEN I PRINT RECORDS THEY ARE IN BY ROOM ORDER... THNX REPLY ME AT MY EMAIL... [email protected] thnnnxx a lot sir... KEITH
Submitted byAnonymous (not verified)on Fri, 05/07/2010 - 15:48

Hi, I'm am currently doing my internship in a company. My topic is Museum Management System which has to deal with some RFID technology. However, I'm very new in IT field, it's kind of difficult for me to do it. I'm wondering if you can guide me? I hope to keep in touch with you. Thank you
Submitted byAnonymous (not verified)on Wed, 07/28/2010 - 14:14

i have created a data report in vb6 with data environment. it is running ok. but the problem is when i want to change the connection of the data report to the database. i have many database and i want a single report to display their contents by choosing from a list what database to use. can you send me a sample of how to do this. thanks, Dadang
Submitted byAnonymous (not verified)on Sun, 09/26/2010 - 05:31

sir in my enrollment system program,the record didn't display at form edit.here is the code: Private Sub cmdsave_Click() adoedit.Recordset.Fields("studentnumber").Value = txtnumer.Text adoedit.Recordset.Fields("lastname").Value = txtlast.Text adoedit.Recordset.Fields("firstname").Value = txtfirst.Text adoedit.Recordset.Fields("middlename").Value = txtmiddle.Text adoedit.Recordset.Fields("address").Value = txtaddress.Text adoedit.Recordset.Fields("nationality").Value = txtnationality.Text adoedit.Recordset.Fields("religion").Value = txtreligion.Text adoedit.Recordset.Fields("gender").Value = txtgender.Text adoedit.Recordset.Fields("contactnumber").Value = txtcontactnumber.Text adoedit.Recordset.Fields("cvilstatus").Value = txtcivilstatus.Text adoedit.Recordset.Fields("course").Value = cmbcourse.Text adoedit.Recordset.Fields("year").Value = cmbyear.Text adoedit.Recordset.Fields("father").Value = txtfather.Text adoedit.recordser.Fields("foccupation").Value = txtfoccupation.Text adoedit.Recordset.Fields("mother").Value = txtmother.Text adoedit.Recordset.Fields("moccupation").Value = txtmoccupation.Text adoedit.Recordset.Fields("guardian").Value = txtguardian.Text adoedit.Recordset.Update MsgBox "information was successfully saved", vbOKOnly, "Record" End Sub sir can you help me with this? thanks.laverne
Submitted byAnonymous (not verified)on Tue, 05/17/2011 - 14:49

In reply to by Anonymous (not verified)

Private Sub cmdsave_Click() adoedit.Recordet.AddNew adoedit.Recordset.Fields("studentnumber").Value = txtnumer.Text adoedit.Recordset.Fields("lastname").Value = txtlast.Text adoedit.Recordset.Fields("firstname").Value = txtfirst.Text adoedit.Recordset.Fields("middlename").Value = txtmiddle.Text adoedit.Recordset.Fields("address").Value = txtaddress.Text adoedit.Recordset.Fields("nationality").Value = txtnationality.Text adoedit.Recordset.Fields("religion").Value = txtreligion.Text adoedit.Recordset.Fields("gender").Value = txtgender.Text adoedit.Recordset.Fields("contactnumber").Value = txtcontactnumber.Text adoedit.Recordset.Fields("cvilstatus").Value = txtcivilstatus.Text adoedit.Recordset.Fields("course").Value = cmbcourse.Text adoedit.Recordset.Fields("year").Value = cmbyear.Text adoedit.Recordset.Fields("father").Value = txtfather.Text adoedit.recordser.Fields("foccupation").Value = txtfoccupation.Text adoedit.Recordset.Fields("mother").Value = txtmother.Text adoedit.Recordset.Fields("moccupation").Value = txtmoccupation.Text adoedit.Recordset.Fields("guardian").Value = txtguardian.Text adoedit.Recordset.Update MsgBox "information was successfully saved", vbOKOnly, "Record" End Sub
Submitted byAnonymous (not verified)on Fri, 10/01/2010 - 03:17

hi sir can you please give me a project of school management system in VB6.0 with back end as oracle. here is my e-mail: [email protected] thanks a lot..
Submitted byAnonymous (not verified)on Tue, 01/11/2011 - 00:07

sir how to create a dataflow diagram in reservation and ticketing system? how to create a employee user name password,log in log out,at cia lng mkkbago ng password nia? ganun din ang admin super visor cashier customer
Submitted byAnonymous (not verified)on Mon, 02/28/2011 - 08:48

...how to display a out of stocks in a listview in visual basic 6.0...please replly..thank you
Submitted byAnonymous (not verified)on Sun, 03/20/2011 - 11:14

Sir, can you help me about Computer Laboratory Inventory (interface only) .I need it for my school project,hope you could help me about it.Thank you in advance.
Submitted byAnonymous (not verified)on Thu, 09/01/2011 - 18:37

sir can u teach me how to create a renting video codes using vb6and database and have a dataenvironment,sori 4 disturbing,i am freshmen student in computer programming..ned help
Submitted byAnonymous (not verified)on Thu, 09/01/2011 - 18:42

would u give me a sample codes of renting video using vb6 and mdbaccess and dataenvironment
Submitted byAnonymous (not verified)on Thu, 09/22/2011 - 14:14

Access data assign the vb form the method of class project access data one row value given one textbox another textbox given access database column value Now click on command button the MS-Access database particular row and column value display in Third Text box. How to create, connection, coding with simple example If you send the simple project my id? my id is:- [email protected] thank you.
Submitted byAnonymous (not verified)on Sat, 10/15/2011 - 00:48

dear sir please suggest me that how i show data in datagrid what i'll do for that please send me a project where use this e-mail ID [email protected] please sir..

sir can help me with my proposed thesis this sem, our proposal is student record management system for elementary school! can you suggest what is our design, IPO and HIPO because I don't have any idea yet on what to do! my email is: [email protected], kindly send me! thank you very much.
Submitted byAJIT MOKAL (not verified)on Tue, 05/29/2012 - 22:58

Dear Sir following is my code to view equipment history report as per year I typed in the text box code is successed but.I want to sort my equipment history report by month so please anybudy help me? my mail [email protected] Private Sub PBY_Click() Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset If cn.State = adStateOpen Then cn.Close cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\CSP.mdb" & ";Persist Security Info=False;Jet OLEDB:Database Password=csp" rs.CursorLocation = adUseClient rs.Open "SELECT Date,Month,Year,Name_of_Parts_Replaced, Reason_of_Replacement, Maintenance_job_description, Notification_No,Serviced_by,remarks From DC1AHISTORY WHERE year ='" & search.Text & "'", cn, adOpenKeyset, adLockOptimistic Set DC1AHistoryPRN.DataSource = rs DC1AHistoryPRN.Show End Sub
Submitted byAnonymous (not verified)on Mon, 02/04/2013 - 20:49

how to print bill on ms word sir plz help me
Submitted byAnonymous (not verified)on Mon, 03/11/2013 - 09:45

sir help please....i have a command1_grouping my problem is when i filter rscommand1 from dataenvironment the vb dont recognize the rscommand1 thanks in advance

Add new comment