Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP and ADO
Message
From
08/02/2000 07:53:18
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
08/02/2000 06:23:30
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00328681
Message ID:
00328693
Views:
16
>Where can i find samples of how to use VFP with ADO
>
>Thanks


Hi Francis,
Read John V Petersen's article "ADO Jumpstart for Microsoft Visual FoxPro Developers" on MSDN online. And sample below should make you a quick start :)
* On a test form
* Put an "MS ADO Data control" and "MS Hierarchical Flexgrid Control"
* Name grid control "Hflex", ADO control "ADOData" - or change below

* ADOData.init
#Define TESTDATALOC C:\ddrive\TEMP\testdata.DBC

strCn =	[Provider=MSDataShape.1;Persist Security Info=False;]+;
[Data Source="Data Provider = MSDASQL;]+;
[DSN=Visual FoxPro Database;UID=;SourceDB=TESTDATALOC;]+;
[SourceType=DBC;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;]+;
[Deleted=Yes;";Data Provider=MSDASQL ]

strShp = [SHAPE { select Company, cust_id from customer } ]+;
[APPEND (( SHAPE { select distinct First_name, Last_name, a.emp_id + cust_id as "Emp_sel", cust_id  from employee a inner join orders b on a.emp_id = b.emp_id }  ]+;
[APPEND (( SHAPE { select order_date, order_net, shipped_on, emp_id + cust_id as "Emp_sel",order_id 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 rsCustomers ]+;
[RELATE emp_sel TO emp_sel )) AS rsOrders  ]+;
[RELATE cust_id TO cust_id ) ]

With this
	.CommandType = 1
	.ConnectionString = strCn
	.RecordSource = strShp
Endwith

* Prepare HFlex Grid
with ThisForm.HFlex
	.Datasource = ThisForm.ADOData.object
	for ix = 1 to .Cols - 1
		.MergeCol(ix) = .t.  && Merge cols
	endfor
	.FormatString = "<Customer Name                     |<Customer Id" && First band headers
	.GridColorBand(1) = rgb(255,0,0) && Play with gridline coloring
	.GridColorBand(2) = rgb(0,0,255)
	.GridColorBand(3) = rgb(0,255,0)
	.ColWidth(2,1) = 0 && Make some cols invisible
	.ColWidth(3,1) = 0
	.ColWidth(3,2) = 0
	.ColWidth(0,3) = 0
	.MergeCells = 3
endwith	
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform