PdcDBQuery.GetField: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
Created page with "== Declaration == GetField(FieldName as String) as Variant == Description == Returns the value of the supplied fieldname for the current record == Notes == This method will..."
 
MKob (talk | contribs)
 
(One intermediate revision by one other user not shown)
Line 9: Line 9:


== Code example ==
== Code example ==
This code example executes a SQL statement and returns the customer name of the first record.


<source lang="vb">
<source lang="vb">
Sub sExecuteQuery
dim objQuery
dim intCnt


  set objQuery = pdc.Database.OpenQuery(pdcConData)
  objQuery.SQL = "SELECT * FROM LK_KLANT"
  if objQuery.Execute then
    objQuery.FirstRecord
    msgbox objQuery.GetField("KL_NAAM")
  else
    msgbox "Error:" & vbCrLf & pdc.LastError & vbCrLf & vbCrLf & "SQL:" & vbCrLf & objQuery.SQL
  end if
End Sub
</source>
</source>


== Availability ==
== Availability ==
Available since September 2008 (from version 3.8)
Available since September 2008 (from version 3.8)

Latest revision as of 15:04, 27 December 2021

Declaration

GetField(FieldName as String) as Variant

Description

Returns the value of the supplied fieldname for the current record

Notes

This method will return a field from a record.

Code example

This code example executes a SQL statement and returns the customer name of the first record.

Sub sExecuteQuery
dim objQuery
dim intCnt

  set objQuery = pdc.Database.OpenQuery(pdcConData)
  objQuery.SQL = "SELECT * FROM LK_KLANT"

  if objQuery.Execute then
    objQuery.FirstRecord
    msgbox objQuery.GetField("KL_NAAM")
  else
    msgbox "Error:" & vbCrLf & pdc.LastError & vbCrLf & vbCrLf & "SQL:" & vbCrLf & objQuery.SQL
  end if
End Sub

Availability

Available since September 2008 (from version 3.8)