>Hello Cetin,
>
>Still no luck I fear.
>
>I have absolutely nothing else in the form, just a subclassed HFlexGrid and Ado Data Control.
>And now the code you gave in the INIT method.
>
> _SCREEN.PRINT( IIF( TYPE("THISFORM.HFlexGrid1") = "O" AND !ISNULL(THISFORM.HFlexGrid1) , ;
> "Flexgrid is here", "Flexgrid is missing" ) + CHR(13) )
> _SCREEN.PRINT( IIF( TYPE("THISFORM.ADODc1") = "O" AND !ISNULL(THISFORM.ADODc1), ;
> "ADODc is here", "ADODc is missing" )+CHR(13) )
> THISFORM.HFlexGrid1.DATASOURCE = THISFORM.Adodc1.object
>
>I then tried using a prg to get me the recordset from Fox2x tables.
>
> #INCLUDE "..\PRGLIB\ADOCONST.H"
> PUBLIC oCon, oRs
> oCon = CREATEOBJECT( "ADODB.CONNECTION")
> WITH oCon
> .Provider = "MSDataShape"
> .ConnectionString = "Data Provider=MSDASQL.1;Persist Security Info=False;Data Source=VFPDILIP"
> .OPEN
> ENDWITH
> oRs = CREATEOBJECT( "ADODB.RECORDSET")
> WITH oRs
> .ActiveConnection = oCon
> .SOURCE = 'SHAPE {SELECT * FROM INV_MAST WHERE INV_TYPE = "I"} AS INV_MAST ' ;
> + ' APPEND ( { SELECT INV_CODE, BRD_CODE, ITM_YEAR, ITM_CODE FROM ITM_MAST} RELATE "INV_CODE" TO "INV_CODE") AS ITEMS'
> .CursorType = adOpenStatic
> .LockType = adLockReadOnly
> .CursorLocation = adUseClient
> .OPEN
> ?"RecordCount:",.RECORDCOUNT
> ENDWITH
>
>Then tried to connect this recordset to the ADO data on the form, like so from the Command window,
>
> oAdo = _SCREEN.ACTIVEFORM.AdoDc1
> oAdo.OBJECT.RecordSet = oRs -----> OLE Error 'member not found'
>
>Any help would be 'preciated.
>
>Dilip Pillai
Hi Dilip,
It might be a object ref. variable scope problem, I'm not sure. Why not directly use ADODc1 control on form :
#define DATA_LOC C:\program files\vfp5\samples\data\testdata.DBC
strCn = [Provider=MSDataShape.1;Persist Security Info=False;]+;
[Data Source="Data Provider = MSDASQL;]+;
[DSN=Visual FoxPro Database;UID=;SourceDB=DATA_LOC;]+;
[SourceType=DBC;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;]+;
[Deleted=Yes;";Data Provider=MSDASQL ]
strShp = [SHAPE { select cust_id , Company from customer } ]+ ;
[ APPEND (( SHAPE { select cust_id, order_id, order_date, ]+;
[ order_net, shipped_on from orders } ]+;
[ APPEND ( { select order_id, line_no, prod_name from orditems ]+;
[ inner join products on products.product_id = orditems.product_id } ]+;
[ AS rsOrditems RELATE order_id TO order_id )) ] +;
[ AS rsOrders RELATE cust_id TO cust_id ) ]
with thisform.ADODc1
.CommandType = 1
.ConnectionString = strCn
.RecordSource = strShp
endwith
Anyway I sent you a sample form :)
Cetin