ADO DataGrid Help

ADO DataGrid Help

Post by Donini Donin » Tue, 02 Nov 1999 04:00:00



Can two separate Tables from two separate .mdb files (Connections) be
combined into one DataGrid?

I am using     Jet 4.0,    VB6 SR3,    ADO 2.1,    Access type data (.mdb)

One table only contains a number which is a reference to a word in the
second table (an index).  The first table is loaded into the grid and
displayed.  The numeric values are displayed on the grid.  How would it be
possible to   format the column with the numeric values to show the word
from the second table that matches the numeric value.

If the tables where in the same database file a query could be created, but
how can this be done with two separate database files???

 
 
 

1. Need help: ADO recordset's recordcount work unproperly with a datagrid control

Hi,

I have problems with ADO and datagrid. I don't know if it's a bug or not and
who can help me . The problem is just as follows:

Enviroment: VB6.0+SP5
            ADO2.1 Library

Problem Description:
        I created an ADO recordset and set it as datasource of a datagrid
control.  Firstly, I add new records into it. Then  I delete all the added
records. The ADO recordset's record count is 0. It's all right .
        But after that, if I add a new record into the ADO recordset , the
ADD operation is successful, but the recordset' recordcount doesn't change.
It's still ZERO. That's WRONG. The correct recordcount should be 1.
        If I doesn't set the ADO recordset as the datasource of a datagrid
control, everything is all right.

**********************1**************************
Code sample 1:

dim rs as ADODB.Recordset
set rs=new ADODB.Recordset
rs.open
rs.fields.append "Field1", adchar,5
rs.fields.append "Field2", adchar,5
set datagrid1.datasource=rs

'add two record into rs. the rs.recordcount is 2
rs.addnew
rs!Field1="a1"
rs!Field2="a2"

rs.addnew
rs!Field1="b1"
rs!Field2="b2"

'then delete all the records. The rs.recordcount is 0
rs.movefirst
rs.delete
rs.movefirst
rs.delete

'the problem comes when I add a new record into rs. the rs.recordcount
remains 0
rs.addnew
rs!Field1="c1"
rs!Field2="c2"
rs.update
'rs.recordcount is still 0 here

***************2*******************
Code sample 2:
'If I does not set the rs as
'the datagrid control's datasource.
'Everything is OK.
dim rs as ADODB.Recordset
set rs=new ADODB.Recordset
rs.open
rs.fields.append "Field1", adchar,5
rs.fields.append "Field2", adchar,5

'<<<<<set datagrid1.datasource=rs>>>>> remove this line

'add two record into rs. the rs.recordcount is 2
rs.addnew
rs!Field1="a1"
rs!Field2="a2"

rs.addnew
rs!Field1="b1"
rs!Field2="b2"

'then delete all the records. The rs.recordcount is 0
rs.movefirst
rs.delete
rs.movefirst
rs.delete

'thersis no problem when I add a new record into rs.
rs.addnew
rs!Field1="c1"
rs!Field2="c2"
rs.update
'rs.recordcount changes to 1 here

2. ODBC Text Driver?

3. Professor needs help with ADO/DataGrid....BeforeColUpdate Event

4. Share

5. Help with ado datagrid

6. Help - ADO Datagrid problems

7. Rowset not bookmarkable on datagrid using ADO - Help!

8. DataGRid + ADO help

9. Please Help: Strange Error with VC++6, ADO and DataGrid Control

10. need help with Datagrid / ADO Data Control / Access Database / delete method

11. help to connect datagrid to ado datasource please!