home *** CD-ROM | disk | FTP | other *** search
- Save Format v1.3
- @begin Form "WinExcel70"
- Exported 0;
-
- @begin Object "WDialog"
- WSCaption 1;
- WSSizeable 1;
- WSDlgBorder 1;
- WSSysMenu 1;
- WSSystemMenu 1;
- WSMinimizeBox 1;
- WSMaximizeBox 1;
- WSGroup 1;
- WSTabStop 1;
- WSResizeBorder 1;
- WSVisible 1;
- FormPositionType "Centered";
- FormAbsTop "219";
- FormAbsLeft "265";
- FDXStructName "WinExcel70FDXStruct";
- Font "8.MS Sans Serif";
- Text "Microsoft Excel 7.0 Example";
- @begin Event "Create"
- GencodeSrcLine 222;
- FunctionName "WinExcel70::WinExcel70_Create";
- @end;
- @begin UserFunction "WinExcel70()"
- Compiler 1;
- GencodeSrcLine 236;
- FunctionName "WinExcel70::WinExcel70()";
- @end;
- @begin UserFunction "~WinExcel70()"
- Compiler 1;
- GencodeSrcLine 240;
- FunctionName "WinExcel70::~WinExcel70()";
- @end;
- @begin UserFunction "Process( WWindow *parent )"
- GencodeSrcLine 244;
- FunctionName "WinExcel70::Process( WWindow *parent )";
- @end;
- @begin UserFunction "Prototype for Process( WWindow *parent )"
- Private 1;
- GencodeSrcLine 66;
- FunctionName "WinExcel70::Prototype for Process( WWindow *parent )";
- @end;
- ResID 105;
- DesignName WinExcel70;
- TabIndex 0;
- DesignRect 262,218,222,94;
- @end;
-
- @begin Object "WQuery"
- BindLimit "0";
- ConcurrencyLevel "WQCLLock";
- CursorType "WQCTDynamic";
- SQL "select * from `Company`\r\norder by Employee";
- Transaction "WinExcel70::transaction_excel70";
- AutoOpen "0";
- ResID 101;
- DesignName query_excel70;
- TabIndex 0;
- DesignRect 10,55,19,17;
- @end;
-
- @begin Object "WLabel"
- WSSLeftNoWordWrap 1;
- WSSNotify 1;
- WCCSNoResize 1;
- WCCSNoParentAlign 1;
- WSChild 1;
- WSMinimizeBox 1;
- WSGroup 1;
- WSVisible 1;
- AutoSize "1";
- Text "Employee:";
- ResID 102;
- DesignName label_1;
- TabIndex 0;
- DesignRect 10,10,33,8;
- @end;
-
- @begin Object "WTransaction"
- DataSource "Excel 7.0 Optima Example";
- AutoConnect "0";
- ResID 103;
- DesignName transaction_excel70;
- TabIndex 1;
- DesignRect 30,55,19,17;
- @end;
-
- @begin Object "WTextBox"
- WTextBoxAutoHScroll 1;
- WSBorder 1;
- WSChild 1;
- WSMaximizeBox 1;
- WSTabStop 1;
- WSExClientEdge 1;
- WSVisible 1;
- DataColumns "Employee";
- DataSource "WinExcel70::query_excel70";
- FDXFieldName "textb_1_data";
- FDXFieldType "WString";
- ResizePercentages "[ 0 0 100 0 ]";
- ResID 104;
- DesignName textb_1;
- TabIndex 1;
- DesignRect 60,10,145,12;
- @end;
-
- @begin Object "WLabel"
- WSSLeftNoWordWrap 1;
- WSSNotify 1;
- WCCSNoResize 1;
- WCCSNoParentAlign 1;
- WSChild 1;
- WSVisible 1;
- AutoSize "1";
- Text "Start date:";
- ResID 105;
- DesignName label_2;
- TabIndex 2;
- DesignRect 10,25,30,8;
- @end;
-
- @begin Object "WTextBox"
- WTextBoxAutoHScroll 1;
- WSBorder 1;
- WSChild 1;
- WSMaximizeBox 1;
- WSTabStop 1;
- WSExClientEdge 1;
- WSVisible 1;
- DataColumns "StartDate";
- DataSource "WinExcel70::query_excel70";
- FDXFieldName "textb_2_data";
- FDXFieldType "WString";
- ResizePercentages "[ 0 0 100 0 ]";
- ResID 106;
- DesignName textb_2;
- TabIndex 3;
- DesignRect 60,25,145,12;
- @end;
-
- @begin Object "WLabel"
- WSSLeftNoWordWrap 1;
- WSSNotify 1;
- WCCSNoResize 1;
- WCCSNoParentAlign 1;
- WSChild 1;
- WSVisible 1;
- AutoSize "1";
- Text "Salary:";
- ResID 107;
- DesignName label_3;
- TabIndex 4;
- DesignRect 10,40,21,8;
- @end;
-
- @begin Object "WTextBox"
- WTextBoxAutoHScroll 1;
- WSBorder 1;
- WSChild 1;
- WSMaximizeBox 1;
- WSTabStop 1;
- WSExClientEdge 1;
- WSVisible 1;
- DataColumns "Salary";
- DataSource "WinExcel70::query_excel70";
- FDXFieldName "textb_3_data";
- FDXFieldType "WString";
- ResizePercentages "[ 0 0 100 0 ]";
- ResID 108;
- DesignName textb_3;
- TabIndex 5;
- DesignRect 60,40,145,12;
- @end;
-
- @begin Object "WDataNavigator"
- WSChild 1;
- WSMaximizeBox 1;
- WSTabStop 1;
- WSVisible 1;
- BOFAction "WDNActionMoveFirst";
- DataSource "WinExcel70::query_excel70";
- EOFAction "WDNActionMoveLast";
- ShowAdd "1";
- ShowCancel "1";
- ShowDelete "1";
- ShowEdit "1";
- ShowMoveFirst "1";
- ShowMoveLast "1";
- ShowMoveNext "1";
- ShowMovePrevious "1";
- ShowRefresh "1";
- ShowUpdate "1";
- ResID 109;
- DesignName datanavigator_1;
- TabIndex 6;
- DesignRect 60,60,147,13;
- @end;
-
- @begin HPPPrefixBlock
- @begin-code HPPPrefix
-
- // Declarations added here will be included at the top of the .HPP file
-
- @end-code;
- GencodeSrcLine 13;
- @end;
-
- @begin CPPPrefixBlock
- @begin-code CPPPrefix
-
- // Code added here will be included at the top of the .CPP file
-
- static WChar *Driver_keys[]={
- WTEXT( "Description" ), WTEXT( "" ),
- WTEXT( "ScanRows" ), WTEXT( "25" ),
- WTEXT( "FileOpenCache" ), WTEXT( "0" ),
- WTEXT( "CacheSize" ), WTEXT( "256" ),
- WTEXT( "IntlSort" ), WTEXT( "0" ),
- WTEXT( "CharacterLengthGuessing" ), WTEXT( "0" ),
- NULL
- };
-
- static WChar Driver[]=
- WTEXT( "INTERSOLV OEM 2.12 32-BIT Excel5Workbook" );
-
- static WChar Datasource[]= WTEXT( "Excel 7.0 Optima Example" );
-
- static WChar DBFile[]= WTEXT( "excel70.xls" );
-
- // Include definitions for resources.
- #include "WRes.h"
- #include "odbcadm.hpp"
- #include "applic.hpp"
-
- @end-code;
- GencodeSrcLine 10;
- @end;
-
- @begin ClassContentsBlock
- @begin-code ClassContents
-
- public:
- // add your public instance data here
- private:
- // add your private instance data here
- WString _dbfile;
-
- protected:
- // add your protected instance data here
-
- @end-code;
- GencodeSrcLine 58;
- @end;
-
- @begin-code GeneratedClassContents
-
- WinExcel70();
- ~WinExcel70();
-
- @end-code;
-
- @begin-code Code "WinExcel70::WinExcel70()"
-
- WinExcel70::WinExcel70()
- {
-
- }
-
- @end-code;
-
- @begin-code Code "WinExcel70::~WinExcel70()"
-
- WinExcel70::~WinExcel70()
- {
-
- }
-
- @end-code;
-
- @begin-code Code "WinExcel70::Process( WWindow *parent )"
-
- WBool WinExcel70::Process( WWindow *parent )
- {
- WString driver_dll;
- WStringArray keys;
- int i;
- WString db_file;
- WFilePath path;
- WString dir;
-
- if( !ODBCAdmin::DriverExists( Driver, driver_dll ) ) {
- WMessageBox::Messagef( parent, WMBLevelError, WMBButtonOk, "Driver Error",
- "The ODBC Driver '%s' is not installed. Data source cannot "
- "be created.", Driver );
- return( FALSE );
- }
-
- for( i = 0; Driver_keys[i] != NULL; ++i );
- keys.SetCount( i + 4 );
- for( i = 0; Driver_keys[i] != NULL; ++i ) {
- keys[i] = Driver_keys[i];
- }
- keys[i] = WTEXT( "Driver" );
- keys[i + 1] = driver_dll;
- keys[i + 2] = WTEXT( "Database" );
- db_file = Application->GetProgramPath();
- path = db_file;
- dir = path.GetDirectory();
- dir.Concat( "\\.." );
- path.SetFileName( DBFile );
- path.SetDirectory( dir );
- path.CleanDirectory();
- if( !path.Exists() ) {
- WMessageBox::Messagef( parent, WMBLevelError, WMBButtonOk, "Data source Error",
- "The data file '%s' could not be found", path.GetText() );
- return( FALSE );
- }
- keys[i + 3] = path;
- _dbfile = path;
-
- if( !ODBCAdmin::AddDataSource( Datasource, Driver, keys ) ) {
- WMessageBox::Messagef( parent, WMBLevelError, WMBButtonOk, "Data source Error",
- "The ODBC Datasource '%s' could not be installed", Datasource );
- return( FALSE );
- }
-
- Create( parent );
-
- return( FALSE );
- }
-
- @end-code;
-
- @begin-code Code "WinExcel70::Prototype for Process( WWindow *parent )"
-
- public:
- WBool Process( WWindow *parent );
-
- @end-code;
-
- @begin-code Code "WinExcel70::WinExcel70_Create"
-
- WBool WinExcel70::WinExcel70_Create(
- WObject * source,
- WCreateEventData * event )
- {
- WString connect_parms;
-
- connect_parms.Sprintf( "database=%s", _dbfile.GetText() );
- transaction_excel70->SetConnectParams( connect_parms );
- transaction_excel70->Connect();
- query_excel70->Open();
- query_excel70->MoveFirst();
-
- return FALSE;
- }
-
- @end-code;
- @end;
-