Click or drag to resize

IDatabaseGetADOConnection Method

Returns an ADO Connection object for the current database. Returns an error if this is the Application.Database object. To connect to the database we have made it simple to get the connection string. This will require some sort of login. GetADOConnection creates a new connection each time you call it, and its only possible to call it trough the SuperOfficedb Library, calling it from SOApplication will generate an error.

Namespace:  SuperOffice.COM.SuperOfficeDB
Assembly:  SuperOfficeDB.Interop (in SuperOfficeDB.Interop.dll) Version: 8.0.0.0
Syntax
Object GetADOConnection()

Return Value

Type: Object
Object - The actual connection string
Examples

Get the ADO connection

This text may be copied to the notepad, and saved as a *.vbs file. Remember to change the login information.

VB
Dim objdb
Set objdb =  createobject("superofficedb.database")
if not objdb is nothing then
    isOk = objdb.login("<userid>", "<password>")
    if isOk then
       Set con = objdb.GetAdoConnection
       Set rs = con.Execute("select * from associate where type = 1")
       While not rs.eof
           msg = msg & rs(1).Value & vbcrlf
           rs.movenext
       Wend
       MsgBox msg, vbinformation + vbokonly, "List of resources"
    else
       MsgBox "unable to connect to  database"
    end if
else
    MsgBox "unable to create database object"
end if
set objdb =  nothing

See Also