Your SlideShare is downloading. ×
Data base connectivity and flex grid in vb
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Data base connectivity and flex grid in vb


Published on

Published in: Education

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Database Connectivity using ADODB
  • 2. 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
  • 3. 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
  • 4. 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
  • 5. 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
  • 6. 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.
  • 7. Database Connectivity Steps Make a VB application that can be used to connect to database
  • 8.  Go to components
  • 9.  Choose Microsoft ADO Data Control 6.0(OLEDB)
  • 10.  Component is added
  • 11.  Click on Adodc and go to its properties
  • 12.  Click on Build
  • 13.  Select Microsoft Jet 4.0 OLE DB Provider and next
  • 14.  Select database and test the connection
  • 15.  From here copy connection string and click ok
  • 16. 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
  • 17. Conti..txt_id = rs.Fields(0)txt_name = rs.Fields(1)txt_desig = rs.Fields(2)txt_add = rs.Fields(3)txt_sal = rs.Fields(4)txt_doj = rs.Fields(5)txt_phn = rs.Fields(6)txt_email = rs.Fields(7)
  • 18. How to use Flex Grid in VB Go to components
  • 19.  Choose Microsoft FlexGrid Control 6.0 from components
  • 20.  Select flexgrid from toolbox and drop it in form
  • 21.  Select Data tool from tool box and drop it in form
  • 22.  Select DataSource property of FlexGrid
  • 23.  Choose DatabaseName from Data tool properties
  • 24.  Choose your database which you want to use
  • 25.  Choose Recordset property of Data tool
  • 26.  Your selected recordset will be shown in flexgrid
  • 27. How to use data grid in VB Go to components
  • 28.  Select Microsoft DataGrid Control 6.0(OLEDB)
  • 29.  Select data grid from tool box and drop in form
  • 30.  Go to Adodc properties
  • 31.  Select Microsoft Jet 4.0 ILE Db Provider
  • 32.  Select database name
  • 33.  Test the connection
  • 34.  Go to RecordSource select CommandType as 2- adCmdTable and Table
  • 35.  Select DataSource from data grid properties
  • 36.  Your data grid is working
  • 37. References