0

Hi,
Am new to VB. Can anyone tell me the code to import data from a DB table and display it in a farpoint spread control 3.0??? VB6.0 code is reqd., thanks in advance.

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by ratheeshpranava
0

What is the database that you want to connect ?

How you connect to database ?

SQL server DB, and i connect to it using ADO
Here is the connection string :
con = "Provider = MSDASQL.1; Extended Properties= 'DSN=Sample; UID=servionuser ;PWD=servionT@123; APP=Visual Basic ;WSID=SGSLDTP0341; DATABASE=MediusDB'"

0

1. Connect to database.
2. Create Recordset.
3. Populate the grid using the recordset as the source.

use the properties and methods of the control to bind to the DB recordset.

0

Or you can use below method........

Dim con As New ADODB.Connection

Private Sub Command1_Click()
Dim rs As Recordset
con.ConnectionString = "Type Connection String"
con.Open
Set rs = con.Execute("select * from customers")

With rs
If Not rs.EOF And Not .BOF Then
Do While Not .EOF
spCustomer.Row = spCustomer.MaxRows
spCustomer.Col = 1
spCustomer.Text = .Fields("CustomerID")
spCustomer.Col = 2
spCustomer.Text = .Fields("CustomerName")

spCustomer.MaxRows = spCustomer.MaxRows + 1
.MoveNext
Loop
End If
End With
End Sub

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.