Unbound Datagrid Confusion!

Unbound Datagrid Confusion!

Post by Steve » Wed, 20 Aug 1997 04:00:00



My users have gotten used to a grid showing all the records within a DAO
Query with a data entry section above it.  I've gotten VB5 Enterprise and
used it for several successful apps with a generic RDO Class.   My Problem
is that I can't figure out how to emulate a bound datagrid.  Everything
I've done is slow, and i can't figure out a quick way to show Updated data.
 This grid needs to hold up to 5,000 records at a time for quick scrolling
and summary/counting purposes.  Any Ideas?

 
 
 

1. Datagrids, Unbound Forms & ADO

Hi!  In the past, I have used ADO controls and bound forms for database
access, but now have a need to use an unbound form, and fill a datagrid
control with data.

I declare the following for the form "frmCharter":

Dim mcnCharterApp As Connection
Dim mrsCharter As Recordset

Next, at the Form Load event, I use the following code to establish the
link to the database:

    Set mcnCharterApp = New Connection
    Set mrsCharter = New Recordset
    mcnCharterApp.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        " Data Source =" & databasePath & ";"

where databasePath is a variable containing the fully qualified path to
my database. (an Access 2000 database).

Now, I want to get all of my records for the date specified, so I use
the following to load up my recordset:

    strQuery = "SELECT
[CHARTER].[CHARTER_EVENT_NAME],[CHARTER].[CHARTER_DESTINATION],[CHARTER].[CHARTER_ORIGINATION],[CHARTER].[CHARTER_SPECIAL_INSTRUCTIONS_1],[CHARTER].[CHARTER_PICKUP_TIME],[CHARTER].[CHARTER_RETURN_TIME],[CHARTER].[CHARTER_DAY_OF_CHARTER],[CHARTER].[CHARTER_QUOTED_PRICE],[CHARTER].[CHARTER_NUMBER_OF_BUSES],[CHARTER].[CHARTER_HOW_CUSTOMER_PAYS],[CHARTER].[CHARTER_DATE_CONTACT_CALLED],[CHARTER].[CHARTER_WAS_SLIP_MADE],[CHARTER].[CHARTERID],[CHARTER].[CONTACTID],[CONTACT].[CONTACTID],[CONTACT].[CONTACT_LAST_NAME],[CONTACT].[CONTACT_FIRST_NAME],[CONTACT].[CONTACT_PHONE_NUMBER]"
& _
                " FROM [CONTACT] INNER JOIN [CHARTER] ON
[CONTACT].[CONTACTID] = [CHARTER].[CONTACTID]" & _
                " WHERE ([CHARTER].[CHARTER_DATE_OF_CHARTER] = #" & _
               Calendar1.Value & "#" & _
                " AND ([CHARTER].[CHARTER_AM_OR_PM_TRIP] = '" & sAMPM &
"'));"
    mrsCharter.Open strQuery, mcnCharterApp, adOpenKeyset, _
                    adLockOptimistic, adCmdText

Finally, I set the record source for my grid control (grdCharter) as
follows:

    Set grdCharter.DataSource = mrsCharter

My question is as follows:  What do I need to do to populate the
information in the recordset into the datagrid.  In the past, when I
have done this with a bound form (datagrid to the ADO control on the
form), this all happened automatically.  It doesn't seem to be happening
this way now, and I suspect that I need to load the form up through
code.

Any thoughts?

Thanks!

-Mike-

2. JDBC Drivers for SQL Server 7

3. How to populate an unbound DataGrid?

4. NY-NEW YORK-11001--ORACLE-DBA Skills-Database Administrator

5. Some confusion with ADO and datagrid

6. Geneal SQL error

7. datagrid with unbound columns ?

8. Some confusion with DataGrid

9. Some confusion with ADO and DataGrid

10. datagrid unbound columns ?

11. DATAWIDGET: Unbound DataGrid-Problem

12. Copy from Datagrid to datagrid