Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data grid population using recordset

Status
Not open for further replies.

newbie1983

Programmer
Sep 9, 2003
52
0
0
GB
I would like to populate a datagrid with all the rows contained in a recordset, how would i go about doing this? i dont really want to use the data environment or any other binding method as alot of errors have occurred as a result. Any ideas would be much appreciated

Regards,

newbie1983
 
Have you considered the Flexgrid control. There is a FAQ on it. You can do so much more with this control, only a thought. Regards
 
The datagrid is very easy to use. create an adodc, set the recordsource & recordset properties. then set the grid's datasource to the adodc. no need to use the data environment. there is some overhead with an adodc, if your data is relatively static you can close it just like any other recordset when not reqired to be open. i use the adodc/datagrid quite a bit and with very few problems.
 
hi newbie,

The ADODC control is ok, but tends to be a little flaky, and slow

I would rather use code like the following

-----------------------------------------------
Public Sub GetTbltitle()

Dim objConn As ADODB.Connection
Dim strConnect As String
Dim strSQL As String

strConnTitle = INI_getString("String", "ConnectString1", App.Path & "\dataconn.ini")

Set objConn = New ADODB.Connection
Set oRSTitle = New Recordset
oRSTitle.CacheSize = 100
oRSTitle.CursorLocation = adUseClient

strSQL = "select * from tbl_title"

oRSTitle.Open strSQL, strConnTitle, adOpenDynamic, adLockBatchOptimistic, adAsyncFetch

Set frmMain.TDBGridTblTitle.DataSource = oRSTitle
frmMain.TDBGridTblTitle.ReBind

End Sub
-------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top