Local oRS As Adodb.recordset, oCon As Adodb.Connection oCon = Createobject("adodb.connection") oCon.ConnectionString = ; 'Provider=Microsoft.Jet.OLEDB.4.0;'+; 'Data Source="'+Sys(5)+Curdir()+[customer.xls]+; '";User ID=Admin;Password=;Extended properties=Excel 5.0' oCon.Open oRS = Createobject('AdoDB.Recordset') With oRS .ActiveConnection=oCon .CursorLocation= 3 && adUseClient *.CursorType= 2 && adOpenDynamic *.LockType= 1 && adLockReadOnly oRS.Open('Select * from [customer$]') Endwith ShowMe("Excel result",oRS) oCon.Close Function ShowMe Lparameters tcCaption,toRecordset oForm = Createobject('myForm', tcCaption,toRecordset) oForm.Show Read Events Endfunc Define Class myform As Form Height = 450 Width = 750 Name = "Form1" Add Object hflex As OleControl With ; Top = 10, Left = 10, Height = 430, Width = 730, Name = "Hflex", ; OleClass = 'MSHierarchicalFlexGridLib.MSHFlexGrid' Procedure Init Lparameters tcCaption,toRecordset This.Caption = tcCaption This.hflex.Datasource = toRecordset This.hflex.AllowUSerResizing = 3 * this.hFlex.FixedCols = 0 Endproc Procedure QueryUnload Clear Events Endproc EnddefineAnd ODBC:
lcXLS = GETFILE("xls") lcConn = "Driver={Microsoft Excel Driver (*.xls)};"+; "DriverId=790;Dbq="+m.lcXLS+; ";DefaultDir="+JustPath(m.lcXLS)+";" lnHandle = SQLStringConnect(m.lcConn) SQLTables(lnHandle,"", "SheetNames") Scan lcTableName = Trim(SheetNames.Table_Name) lcOutput = Chrtran(m.lcTableName,' $','_') SQLExec(lnHandle,'select * from ['+m.lcTableName+']',m.lcOutput ) endscan SQLDisconnect(lnHandle)Cetin