To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=114648





------- Additional comments from siriog...@openoffice.org Tue Sep 21 13:22:35 
+0000 2010 -------
Hi!
Thanks for the answer.

Here are the infos you need:
-Used Macro:

REM  *****  BASIC  *****

Option Explicit

Sub Main
    Dim sDataSourceName as String
    sDataSourceName = InputBox( "Please enter the name of the data source:" )
    EnableParameterNameSubstitution(sDataSourceName )
End Sub

Sub EnableParameterNameSubstitution( sDataSourceName as String )
    ' the data source context (ehm - the service name is historical :)
    Dim aContext as Object
    aContext = createUnoService( "com.sun.star.sdb.DatabaseContext" )

    If ( Not aContext.hasByName( sDataSourceName ) ) Then
        MsgBox "There is no data source named " + sDataSourceName + "!"
        Exit Sub
    End If

    ' the data source
    Dim aDataSource as Object
    aDataSource = aContext.getByName( sDataSourceName )

    ' append the new ParameterNameSubstitution flag
    Dim bFlag as Boolean
    bFlag = TRUE
    Dim aInfo as Variant
    aInfo = aDataSource.Info
    aInfo = AddInfo( aInfo, "ParameterNameSubstitution", bFlag )

    ' and write back
    aDataSource.Info = aInfo
    ' flush (not really necessary, but to be on the safe side :)
    aDataSource.flush
End Sub

Function AddInfo( aOldInfo() as new
com.sun.star.beans.PropertyValue,sSettingsName as String, aSettingsValue as
Variant ) as Variant
    Dim nLower as Integer
    Dim nUpper as Integer
    nLower = LBound( aOldInfo() )
    nUpper = UBound( aOldInfo() )

    ' look if the setting is already present
    Dim bNeedAdd as Boolean
    bNeedAdd = TRUE

    Dim i As Integer
    For i = nLower To nUpper
        If ( aOldInfo( i ).Name = sSettingsName ) Then
            aOldInfo( i ).Value = aSettingsValue
            bNeedAdd = FALSE
        End If
    Next i

    ' allocate the new array
    Dim nNewSize as Integer
    nNewSize = ( nUpper - nLower )
    If bNeedAdd Then nNewSize = nNewSize + 1
    Dim aNewInfo( nNewSize ) as new com.sun.star.beans.PropertyValue

    ' copy the elements (a simply copy does not work in Basic)
    For i = nLower To nUpper
        aNewInfo( i ) = aOldInfo( i )
    Next i

    ' append the new setting, if necessary
    If ( bNeedAdd ) Then
        aNewInfo( nUpper + 1 ).Name = sSettingsName
        aNewInfo( nUpper + 1 ).Value = aSettingsValue
    End If

    AddInfo = aNewInfo()
End Function 

----

- I simply tried to use a variable in the WHEN statement ([...] WHERE [...]
"MOVMAG"."IDFORPAR" = :x [...]).

I got the error after inserting the "x" Value (char o numerical, both mode)

The exact error is: 

-SQLSTATE=07009 -Invalid Descriptor Index 

You tried to set a parameter at position 1 but there is/are only 0 parameter(s)
allowed. One reason may be that the property "ParameterNameSubstitution" is not
set to TRUE in the data source. 

I'm using Ooffice 3.2.1, Ms SQL 2000 and the odbc driver on the client are the
version 2000.85.1132.00.

Thanks again.

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@dba.openoffice.org
For additional commands, e-mail: issues-h...@dba.openoffice.org


---------------------------------------------------------------------
To unsubscribe, e-mail: allbugs-unsubscr...@openoffice.org
For additional commands, e-mail: allbugs-h...@openoffice.org

Reply via email to