[ Home ] [ Features ] [ Products ] [ FAQ's ] [ Screens ] [ Support ] [ Downloads ] [ About ] [ Discussion ]


the software that grows with you

 

V32Acs2Dbf()

Returns a .dbf file pulling out info from an Access databse based on an SQL statement.

Syntax

V32Acs2Dbf( [cConnect], <cDatabase>, <cSql>, <cDbf>, <aStruc>, [lWantInfo], [aProg] )

Arguments

Param Default

Description

cConnect A valid Access ADODB connection string. Default is :"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + cDatabase
cDatabase Name of the database. If <cConnect> has been mensioned, <cDatabase> is ignored as this parameter must be a part of <cConnect>.
cSql A valid SQL statement recognized by Access on the basis of which information will be returned in the <cDbf> with structure <aStruc>.
cDbf A valid file name with .dbf extension containg drive, path and file name with extension. Any extension will do, but better if it is .dbf.. Note that a new file is created everytime this function is executed. Vouch32 does not attempt to open an existing file.
aStruc Two dimensional array of database structure with the help of which <cDbf> will be created. 
lWantInfo FALSE Logical to specify whether Vouch32 should return number of records returned by the <cSql> or not. Defaults to FALSE. means control is returned to application immediately after executing the function. Requested database operations will be executed at the background.
aProg NIL An optional array with following structure which will be used to configure the Progress Bar. The structure is:
cTitle Character string to be displayed in the title bar of progress window. Default is a null string.
nBkColor RGB color value comprising the background color of bar area. Default is the value returned by GetSysColor( COLOR_BTNFACE ).
nBarColor RGB color value comprising the bar color. Default is the value returned by GetSysColor( COLOR_HIGHLITE ).
nStyle Numeric to control the style of the Progress Bar one of the two possible values, 1 or 2. Default is 1 means bar will move as smooth. The other is boxed progress.
lShowPercent Logical to switch on or off whether percent be displayed or not at the middle of progress area. Default is TRUE.
lBorder Logical to specify whether a border be displayed around the progress area or not. Default is FALSE.

Returns

NIL or number of records returned if <lWantInfo> is set to TRUE.

Description

The point to consider most is the number of fields requested in <cSql> and number of fields in <aStruc> must match exactly in number and nature of data being retrieved. If there will be a nismatch, the whole operation will fail.

Usage

local nRec, cSql, cDatabase, cConnect, cDbf, lWantInfo
local aStruc := {}, aProg := {}

cDbf := 'C:\Vouch32\MySql.dbf'

aadd( aStruc, { 'Name' , 'C', 35, 0 } )
aadd( aStruc, { 'Address', 'C', 35, 0 } )
aadd( aStruc, { 'City' , 'C', 15, 0 } )
aadd( aStruc, { 'Salary' , 'N', 10, 2 } )

aProg := { 'Access to Database' }
cDatabase := 'C\Vouch32\MyDatabase.mdb'
cSql := 'SELECT name. address, city, salary FROM employee WHERE salary > 2000'

// If records returned info required and a progressbar has to be displayed
//
lWantInfo := .t.
nRec := V32Acs2Dbf( cConnect, cDatabase, cSql, cDbf, aStruc, lWantInfo, aProg )

// If records returned info not required but progressbar has to be displayed
//
lWantInfo := .f.
V32Acs2Dbf( cConnect, cDatabase, cSql, cDbf, aStruc, lWantInfo, aProg )

// In neither info not progressbar needed
//
lWantInfo := .f.
V32Acs2Dbf( cConnect, cDatabase, cSql, cDbf, aStruc, lWantInfo )

Tips

 

[ Home ][ Features ] [ Products ][ About Us ][ FAQ's ][ Screen Shots ][ Downloads ][ Support ][ Discussion ]
.

Vouch is a Trademark of Pritpal Bedi
All other Trade Marks are the property of their respective owners.
Copyright 1993-2011 Pritpal Bedi. All rights reserved.
Hit Counter  
You are Visitor # since 14 May 2002