|
Best of Support |
|
|
Connecting to a database using ADO |
|
Issue
How do I connect to an external database using ADO?
Solution:
The following is an example of how you can use GhostFill script to establish an ADO link to an external database, and thereafter execute SQL statements directly from a GhostFill FillPoint:
%[adStateOpen=1] %[adOpenDynamic=2] %[adLockOptimistic=3] %[adCmdText=1]
%[con = CreateObject("ADODB.connection")] %[rs = createobject("ADODB.recordset")]
%[con.connectionstring = "data source=GhostFill ODBC Sample;"]
%[con.open()]
%[KeepBlockIf(con.state = adStateOpen)]
%[sql='select * from contacts']
%[rs.open(sql,con,adOpenDynamic,adLockOptimistic,adCmdText)]
%[RepeatBlockWhile(rs.eof=false)]
%[rs.fields('ClientName').value]
%[rs.movenext()]
%[Endblock()]
%[Endblock()]
Daniel Todes