Access Data Objects (ADO) 2.5 or Later

Access Data Objects are an object that links the server scripts to the database.

Within the active server script you must declare the object, set the parameters, and then close the object as soon as possible.

This coding example illustrates how to import data to FDF/PDF from a database

<%@ Language=VBSCRIPT %>

<% Option Explicit %>


On error resume next

Dim RS ‘ Declare Recordset

Dim ConnStr ‘ Declare Connection String

Dim RecordCounter

Dim FDFAcx, FDFin

Set RS = Server.CreateObject(“ADODB.Recordset”)

ConnStr = “Provider=Microsoft.Jet.OLEDB.4.0; Data Source=” & _



‘ Open Updatable Recordset Syntax is as follows

‘ RS.Open SQL/Table, Connection, 3=OpenKeyset, 3=LockOptimistic

RS.Open “Select * From Table_One Where Unique_ID = 2”, ConnStr, 3,3


‘ Check if a record is found

RecordCounter = RS.RecordCount

If RecordCounter < 1 then

          Response.Write “No Records Found”


End if

‘ Call Subroutine to perform Data Population



Sub Perform_Query()

Response.ContentType = "application/vnd.fdf"

Set FdfAcx = Server.CreateObject("FdfApp.FdfApp")

Set FDFout = FdfAcx.FDFCreate

FDFout.FDFSetFile = Server.MapPath(“PDFs/My_PDF.pdf”)


‘ 1. Open FDF From File Or Open from Buffer (Uncomment One of them)

‘ Set FDFin=FdfAcx.FDFOpenFromFile(Server.MapPath(“/PDF/my_file.pdf”))

‘ Set FDFin = FdfAcx.FDFOpenFromBuf (Request.BinaryRead(Request.TotalBytes))


‘ If the field type is a string then add a empty string to the end to not throw an error

FDFout.FDFSetValue “Fieldname_One”, RS(“Fieldname_One") & “”


‘ If the field type is numeric then add zero to not throw an error

FDFout.FDFSetValue “Fieldname_Two”, RS(“Fieldname_Two”) + 0

FDFout.FDFSetStatus “Page Updated with new Values”

Response.BinaryWrite FDFout.FDFSaveToBuf



End Sub




PDF Programming
ASP Server Setup
ASP Programming
Digital Signatures
FDF Programming
ASP.Net Server Setup
Problems and Solutions
VB6 Programming
FDF Exporting
Importing FDF


Copyright © 2003, 1991 - 2002