PdcDBQuery.GetBlobToFile: Difference between revisions

From External Bemet Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 1: Line 1:
== Declaration ==
== Declaration ==
GetField(FieldName as String) as Variant
GetBlobToFile(FieldName as String, FilePath as string) as boolean


== Description ==
== Description ==
Returns the value of the supplied fieldname for the current record
This method stores file in a specific record to a file on disk in an applied location.
Returns true if the file save proceed correctly.


== Notes ==
== Notes ==
This method will return a field from a record.
This method stores file in a specific record to a file on disk in an applied location.


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


<source lang="vb">
<source lang="vb">
Line 17: Line 18:


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


   if objQuery.Execute then
   if objQuery.Execute then
     objQuery.FirstRecord
     objQuery.FirstRecord
     msgbox objQuery.GetField("KL_NAAM")
     msgbox objQuery.GetBlobToFile("at_file", "c:\temp\Filename.pdf")
   else
   else
     msgbox "Error:" & vbCrLf & pdc.LastError & vbCrLf & vbCrLf & "SQL:" & vbCrLf & qryCustomer.SQL
     msgbox "Error:" & vbCrLf & pdc.LastError & vbCrLf & vbCrLf & "SQL:" & vbCrLf & objQuery.SQL
   end if
   end if
End Sub
End Sub
Line 29: Line 30:


== Availability ==
== Availability ==
Available since September 2008 (from version 3.8)
Available since Mai 2019 (version 5.5 onwards)

Latest revision as of 16:22, 14 January 2021

Declaration

GetBlobToFile(FieldName as String, FilePath as string) as boolean

Description

This method stores file in a specific record to a file on disk in an applied location. Returns true if the file save proceed correctly.

Notes

This method stores file in a specific record to a file on disk in an applied location.

Code example

This code example executes a SQL statement and stores a file on disk the first record.

Sub sExecuteQuery
dim objQuery
dim intCnt

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

  if objQuery.Execute then
    objQuery.FirstRecord
    msgbox objQuery.GetBlobToFile("at_file", "c:\temp\Filename.pdf")
  else
    msgbox "Error:" & vbCrLf & pdc.LastError & vbCrLf & vbCrLf & "SQL:" & vbCrLf & objQuery.SQL
  end if
End Sub

Availability

Available since Mai 2019 (version 5.5 onwards)