Click or drag to resize

IDatabaseGetADOConnectionString Method

Returns an ADO connection string corresponding to the current database 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.

To connect to the database we have made it simple to get the connection string, this will only return the string and not build the connection.

This will require some sort of login. Its only possible to call GetADOConnectionString 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
string GetADOConnectionString()

Return Value

Type: String
Object - The actual connection string String – the 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

Get the name of the datasource

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
       constr = objdb.GetAdoConnectionString
       MsgBox constr, vbinformation + vbokonly, "Connection string"

       set con = CreateObject("ADODB.Connection")
       con.Open constr
       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