Connecting Tech Pros Worldwide Forums | Help | Site Map

What is the code for displaying records in a datagrid?

Newbie
 
Join Date: Nov 2008
Location: Philippines
Posts: 1
#1: Nov 19 '08
How can I display my database records in a datagrid?

Can someone help me with these. Im a beginner in vb6

missinglinq's Avatar
Moderator
 
Join Date: Nov 2006
Location: Richmond, Virginia USA
Posts: 3,000
#2: Nov 19 '08

re: What is the code for displaying records in a datagrid?


Since this is a question about VB 6, I'll move it to the Visual Basic Forum.

Welcome to Bytes!

Linq ;0)>

Moderator
lotus18's Avatar
Site Addict
 
Join Date: Nov 2007
Location: Zamboanga City, Philippines
Posts: 860
#3: Nov 19 '08

re: What is the code for displaying records in a datagrid?


There are a lot of ways on how to display records in a datagrid. We have ADODB, ADODC etc.


Rey Sean
QVeen72's Avatar
Moderator
 
Join Date: Oct 2006
Location: Bangalore
Posts: 1,385
#4: Nov 20 '08

re: What is the code for displaying records in a datagrid?


Hi,

Open a Connection Object...
and add a DataGrid Control on your form:
Write this code in Form_Load:

Expand|Select|Wrap|Line Numbers
  1. Dim sSQL As String
  2. Dim RST As New ADODB.Recordset
  3. RST.CursorLocation=adUseClient
  4. sSQL = "select * from MyTable"
  5. RST.Open sSQL, con
  6. Set DataGrid1.DataSource = RST
  7.  
Regards
Veena
Reply


Similar Visual Basic 4 / 5 / 6 bytes