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
SyntaxObject GetADOConnection()
Function GetADOConnection As Object
Dim instance As IDatabase
Dim returnValue As Object
returnValue = instance.GetADOConnection()
Object^ GetADOConnection()
Return Value
Type:
ObjectObject - The actual connection string
ExamplesGet the ADO connection
This text may be copied to the notepad, and saved as a *.vbs file. Remember to change the login information.
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