|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > DBWCommandShell > Library Reference > Database > DBWGetStringFieldData |
Queries a given table from a datasource for a string field through a key field and key value
Function DBWGetStringFieldData(datasource, table, field_to_read, key, keyvalue, ByRef sResult)
datasource |
name of a valid datasource or |
|---|---|
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. |
sResult |
the result of the query as a string |
TRUE |
if the selection found any valid result |
|---|---|
FALSE |
otherwise |
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.
if DBWGetStringFieldData("DBWORKS","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 DBWGetStringFieldData("@USEDEFAULTDATASOURCE","DOCUMENT","SOLIDWORKS_SN","SOLIDWORKS_SN",NsSW, sResult)=TRUE then
...