DBWGetStringFieldData1

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Library Reference > Database >

DBWGetStringFieldData1

Description

Same as DBWGetStringFieldData but allowing the user to specify login and password.
More, it's compatible with Oracle database that does't support "TOP" SQL statement.

Syntax

Function DBWGetStringFieldData1(datasource, login, password, table, field_to_read,key, keyvalue, ByRef sResult)

Parameters

datasource

name of a valid datasource or
"@USEDEFAULTDATASOURCE" to force the usage of the default application datasource as returned from constant DBWorksConnectionDSN

login

a valid login to access the datasource in an autheinticated way

password

the password related to the specified login.

table

name of an existing table in the specified datasource.

field_to_read

name of the field from which the value must be taken.

key

field of which the value will be checked to determine the query selection.

keyvalue

value that will be checked to determine which records to read.

Return values

sResult

the result of the query as a string

TRUE

if the selection found any valid result

FALSE

otherwise

Remarks

Use this function to retrieve values from an ODBC linked database.
This command is equivalent to applying an SQL selection query such as "select " & field_to_read & " from " & table &" WHERE " & key &" ='" & keyvalue & "'".

When connecting through file DSN, it's mandatory to use the datasource declared as @USEDEFAULTDATASOURCE.

See also

Get/Set string functions

Example

if DBWGetStringFieldData1("DBWORKS","bob","pass","DOCUMENT","SOLIDWORKS_SN","SOLIDWORKS_SN",NsSW,sResult)=TRUE then
 res=DBWMsgbox("SolidWorks serial " & NsSW & " already used " & vbcrlf & _
 "must be 19 chars like :" & vbcrlf & "0201 2212 2132 2123",16 )
 exit sub
end if

if DBWGetStringFieldData1("@USEDEFAULTDATASOURCE","bob","pass","DOCUMENT","SOLIDWORKS_SN","SOLIDWORKS_SN",NsSW,sResult)=TRUE then
...