/ Forums / Advansys Formativ / Creating Solutions with Formativ / Can I do an SQL query in a Formativ applet? / Reply To: Can I do an SQL query in a Formativ applet?

Support 1a

The answer depends on the technique you use to access the database. Another user has posted the following information that may help answer your question.


To access any database defined in Data Source Name (you need to install an optional MDAC package from Microsoft. I used MDAC 2.5):

Sub Main(Client, GWEvent)
dim conn
dim arr

set conn = createobject(“ADODB.Connection”)
conn.open(“DSN=putDSNHere; User ID=putUseridHere; ” & _

arr = getRecords(“SELECT * FROM putTableNameHere”)
End Sub

Private Function getRecords(query) ‘returns a dwo-dimensional array with results
dim rs

set rs = conn.execute(query)
getRecords = rs.getRows
End Function

If this doesn’t help, you may wish to consult one of the many VB/VBS resources available. (Formativ doesn’t provide any DB/SQL services inherently – you need to use an external service, such as ADO, to provide DB support).

Advansys Support