DBWListFromQuery1

<< Click to Display Table of Contents >>

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

DBWListFromQuery1

Description

Shows a dialog box that allows to choose between entries retrieved from a query to a datasource that requires authentication.

Syntax

Function DBWListFromQuery1(DataSource, SQLQuery, ColumnToChooseFrom, Title, User, Password, ByRef Resp)

Parameters

DataSource

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

SQLQuery

string containing the query to submit to the datasource.

ColumnToChooseFrom

integer (starting from 1) that specifies the column to choose values from.
If the submitted query is of the format:

SELECT a,b,c
FROM ...

this parameter specify that values will be chosen from a, b or c column.

Title

dialog box title

User

user name

Password

user password

DBWListFromQuery

Return Values

TRUE

if the user has closed the dialog by pressing the OK button

FALSE

if the user has closed the dialog by pressing the CANCEL button

Resp

Contains the item selected. If the function has a FALSE value resp contains a null string.

Remarks

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

See also

Function DBWListFromQuery
 
Function DBWList
Function DBWListFiles
Function DBWListFromFile

Example

datasource = "DBWORKS"
sql_query = "SELECT T,ID FROM DOCUMENT"
column = 2
title = "Item selection"
user = "luca"
pass = "dbworks"
ok = DBWListFromQuery1(datasource, sql_query, column, title, user, pass, resp)
if ok then
 DBWmsgbox "The value selected is " & vbCRLF & resp
else
 DBWmsgbox "The user has canceled"
end if

...
ok = DBWListFromQuery1("@USEDEFAULTDATASOURCE", sql_query, column, title, user, pass, resp)
...