LoadDB

The LoadDB method is used to load a database into a Worksheet document. Returns a Boolean. Returns 'True', if the connection and loading is successful. Returns 'False', if the process fails.

Syntax

object.LoadDB( ConnectionStr, SQLStr, Row, Col )

Parameter

Type

Required/

Optional

Default

Description

ConnectionStr

String

Required

 

This specifies the database connection string.

SQLStr

String

Required

 

This specifies the database options.

Row

Long

Required

 

This specifies the row where database data is to be inserted.

Col

Variant

Required

 

This specifies the column where database data is to be inserted.

Example

This example demonstrates how to load a database into a new worksheet window.

'Declares SurferApp as an object

Dim SurferApp As Object

 

'Creates an instance of the Surfer Application object and assigns it

'to the variable named "SurferApp"

Set SurferApp = CreateObject("Surfer.Application")

 

'Makes Surfer visible

SurferApp.Visible = True

 

'Declares Wks as an object

Dim Wks As Object

 

'Creates a worksheet document in Surfer and assigns it to the variable

'named "Wks"

Set Wks = SurferApp.Documents.Add(srfDocWks)

 

'Loads a database into row 1, column 1

Wks.LoadDB("Provider=MSDASQL.1;Persist Security Info=False;Extended Properties=DBQ=C:\GoldenData\database.mdb;DefaultDir=C:\Data;Driver={Driver do Microsoft Access (*.mdb)};DriverId=281;FIL=MS Access;FILEDSN=C:\Data\new.dsn;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UID=admin; UserCommitSync=Yes;","SELECT * FROM Category",1,1)

Used by: WksDocument object