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

  • Creator
    Topic
  • #3852
    ekimtoor
    Participant

      If it can be done, what would code look like to return data from an SQL query?

    • Author
      Replies
    • #6403
      Support 2
      Moderator

        Hi,

        Sorry for the delay in our response. We are currently participating at BrainShare 2002 in Salt Lake City and we should be able to respond shortly.

        Regards,

        Advansys Support

        #6404
        Support 1a
        Participant

          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.

          quote:


          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; ” & _
          “password=putPasswordHere”)

          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)
          rs.movenext
          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

        Viewing 2 replies - 1 through 2 (of 2 total)
        • You must be logged in to reply to this topic.