I am trying to get connection to an external database, but got stuck on appending data to an array. I am using functions from "OpenOffice.org Base Macro Programming By Andrew Pitonyak" which look like below:
Code: Select all
Sub AppendToArray(oData(), ByVal x)
Dim iUB As Integer 'The upper bound of the array.
Dim iLB As Integer 'The lower bound of the array.
iUB = UBound(oData()) + 1
iLB = LBound(oData())
ReDim Preserve oData(iLB To iUB)
oData(iUB) = x
End Sub
Function CreateProperty(sName$, oValue) As com.sun.star.beans.PropertyValue
Dim oProperty As New com.sun.star.beans.PropertyValue
oProperty.Name = sName
oProperty.Value = oValue
CreateProperty() = oProperty
End Function
Sub AppendProperty(oProperties(), sName As String, ByVal oValue)
AppendToArray(oProperties(), CreateProperty(sName,oValue))
End Sub
Code: Select all
Sub send2DB
Dim sUserName$
Dim oParams As New com.sun.star.beans.PropertyValue
sUserName = "testuser"
AppendProperty(oParams(), "user", sUserName)
End Sub