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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSHFLEXGRID examples 1

Status
Not open for further replies.
Sep 17, 2001
672
US
I am looking for some examples using hiearchical data structures (shaped data) in FoxPro. I have found very little on advanced grid usage in FoxPro and I know it is possible. However from what I have read you must use ado to accomplish it. Has anyone been down this path and have examples showing binding multiple tables to a single grid allowing user to collapse or uncollapse child rows?

Regards,

Rob
 
Thanks, however I am looking for an example that binds to multiple data sources ie, parent child tables so I can allow updating. I am looking at the ado data shape method but I can find no examples in foxpro.

Regards,

Rob
 
I am using an ado object and trying to figure out how to display the data in a shaped recordset. I also want to bind this to a mshflexgrid. I am getting closer to what I am looking for but any help appreciated.

oConn1=CREATEOBJECT("ADODB.Connection")

oRstP1=CREATEOBJECT("ADODB.Recordset")
oRstC1=CREATEOBJECT("ADODB.Recordset")


oConn1.Provider = "MSDataShape"
oConn1.Open("Provider=MSDataShape;Data Provider=MSDASQL;Server=x;Data Source=Maps;User ID=x;Password=x")

oRstP1.StayInSync = .F.
oRstP1.Open("SHAPE {select effort from maps.dbo.effort_only} AS Effort " +;
"APPEND ({select item_id, effort from maps.dbo.Item_Offer} " +;
"RELATE Effort TO Effort) AS Items", oConn1)

Regards,

Rob
 
Well I figured it out. The following code is a sample of how to initialize a MSHFlexgrid using an ADO shaped data set. (This allows you to show one to many in one grid.) The code below I put in the init method of the form and dropped a MSHFlexgrid on the form also named olecontrol1.

PUBLIC oConn1, oRstP1, oRstC1, oRstC2
oConn1=CREATEOBJECT("ADODB.Connection")

oRstP1=CREATEOBJECT("ADODB.Recordset")


oConn1.Provider = "MSDataShape"
oConn1.Open("Provider=MSDataShape;Data Provider=MSDASQL;Server=1.1.1.1;Data Source=Maps;User ID=sa;Password=unknown")

oRstP1.StayInSync = .T.
oRstP1.Open("SHAPE {select Item_id, effort from maps.dbo.effort_only} AS Item_Effort" +;
"APPEND ({select offer_code, Landed_cost, item_id from maps.dbo.Item_Offer} " +;
"RELATE Item_id TO Item_id) AS Items", oConn1)
ThisForm.olecontrol1.recordset=oRstP1

Regards,

Rob
 
Hi, Borislav

You've got a star :) Thanks for referal to my forum. :)

Grigore Dolghin
Class Software
Bucharest, Romania
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top