To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=74374
                 Issue #|74374
                 Summary|Basic Runtime error: method getDate is missing
               Component|Database access
                 Version|OOo 2.1
                Platform|All
                     URL|
              OS/Version|Windows XP
                  Status|UNCONFIRMED
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P3
            Subcomponent|none
             Assigned to|dbaneedsconfirm
             Reported by|szodrow





------- Additional comments from [EMAIL PROTECTED] Fri Feb  9 11:07:41 +0000 
2007 -------
I have a MySQL DB connected via ODBC. In a Basic macro I loop throught the
result set. I want to read the a date column with Resultset.getDate but I get a
runtime error:

Basic Laufzeitfehler 
Eigenschaften oder Methode nicht gefunden

In the following some more information and the code. I also have a problem with
binding dates to the SQL statement, but there I could live with the workaround
below.

:-)

Problem with dates, especially getDate in SQL Query

The runtime error:

Basic Laufzeitfehler 
Eigenschaften oder Methode nicht gefunden

Sql Query (MySQL DB via ODBC 3.51.11 or 5.51.12):

select /* EK Pos */     round(jp.GPREIS * if(jp.brutto_flag = 'Y', 1, (100 +
r.val_double) /100), 2) PosPreis,     j.orgnum as LiefRechNr,     j.rdatum
RechDatum,     jp.gegenkto AufwKto,     substr(jp.bezeichnung, 1, 30) as rText,
    j.gegenkonto Kreditor,     j.vrenum as BelegNrCAO  
from JOURNAL j  
join JOURNALPOS jp on jp.vrenum = j.vrenum  
join REGISTRY r on r.mainkey =  'MAIN\\MWST' 
and r.name = jp.steuer_code  
where (j.quelle = 5 and j.quelle_sub <> 2)  
and j.bsumme <> 0 
and jp.gpreis <> 0  
-- and j.rdatum >= ?  -- binding the date variable without formatting in SQL
Statement makes problem. Is sent in german format, MySQL will not recognize as 
date
and j.rdatum >= str_to_date(?, '%d.%m.%Y')  -- binding the date variable without
formatting makes problem
and j.rdatum <= str_to_date(?, '%d.%m.%Y')  
order by BelegNrCAO 
access

the Basic programm with the error

Sub LiesEKPos (pDatumVon as date, pDatumBis as date)
DatabaseContext = createUnoService("com.sun.star.sdb.DatabaseContext")
DataSource = DatabaseContext.getByName("Adressen") 'DBNameOO

If Not DataSource.IsPasswordRequired Then 
  Connection = DataSource.GetConnection("","")
Else 
  InteractionHandler = createUnoService("com.sun.star.sdb.InteractionHandler")
  Connection = DataSource.ConnectWithCompletion(InteractionHandler)
End If

' worksheet stuff
Dim Doc As Object 
Dim Sheet As Object 
Dim Cell As Object 
'MsgBox "Doc = StarDesktop.CurrentComponent "
'Doc = StarDesktop.CurrentComponent 
Doc = ThisComponent 
Sheet = Doc.Sheets.getByName("EkPos")
' Database stuff
Dim ResultSet As Object
Dim SQLText As String
Dim resultCount as Integer
Dim ColOffset as Integer
Dim RowOffset as Integer
Dim ErgebnisMonat as Integer

' EK Umsaetze 
SQLText =  getNamedCellString ("SQLEKPos")
Statement = Connection.PrepareStatement(SQLText)
Statement.SetString(1, pDatumVon )  ' does not work with plain ? in SQLText, see
workaround above
Statement.SetString(2, pDatumBis )
ResultSet = Statement.executeQuery()
ColOffset = -1
ErgebnisMonat = 0
RowOffset = 1 '+ pRow
resultCount = 0
If Not IsNull(ResultSet) Then 
        While ResultSet.next 
        
'select /* EK Pos */     round(jp.GPREIS * if(jp.brutto_flag = 'Y', 1, (100 +
r.val_double) /100), 2) PosPreis,     
'j.orgnum as LiefRechNr,     
'j.rdatum RechDatum,     
'jp.gegenkto AufwKto,     
'substr(jp.bezeichnung, 1, 30) as rText,     
'j.gegenkonto Kreditor,     
'j.vrenum as BelegNrCAO  from JOURNAL j  join JOURNALPOS jp on jp.vrenum =
j.vrenum  join REGISTRY r on r.mainkey =  'MAIN\\MWST' and r.name =
jp.steuer_code  where (j.quelle = 5 and j.quelle_sub <> 2)  and j.bsumme <> 0
and jp.gpreis <> 0  and j.rdatum >= ? and j.rdatum <= ?  order by BelegNrCAO 
        
                Cell = Sheet.getCellByPosition(ColOffset + 1, resultCount + 
RowOffset)
                Cell.Value = ResultSet.getString(1)
                Cell = Sheet.getCellByPosition(ColOffset + 2, resultCount + 
RowOffset)
                Cell.String = ResultSet.getString(2)
                Cell = Sheet.getCellByPosition(ColOffset + 3, resultCount + 
RowOffset)
MsgBox ResultSet.DBG_methods '                                                <-
has a method getDate
                Cell.String = ResultSet.getDate(3) '                            
        <-
runtime error
                Cell = Sheet.getCellByPosition(ColOffset + 4, resultCount + 
RowOffset)
                Cell.Value = ResultSet.getString(4)
                Cell = Sheet.getCellByPosition(ColOffset + 5, resultCount + 
RowOffset)
                Cell.String = ResultSet.getString(5)
                Cell = Sheet.getCellByPosition(ColOffset + 6, resultCount + 
RowOffset)
                Cell.Value = ResultSet.getString(6)
                Cell = Sheet.getCellByPosition(ColOffset + 7, resultCount + 
RowOffset)
                Cell.Value = ResultSet.getString(7)
                resultCount = resultCount + 1
        Wend 
End If

Connection.close()
End Sub

---------------------------------------------------------------------
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to