[Gambas-user] invalid object error on variable of database queries
Vassilis K
vkan53 at ...2300...
Thu Oct 8 21:50:04 CEST 2009
Hello again,
I have a strange little problem with my database (Mysql) queries.
I make many queries and updates together with the click of a button.
When I make the queries and updates without using any of the results then
everything works fine !!
When I want to use a part of the results I get the invalid object error and
all of the results turn to red ( do not work).
AT the example below I get the error message "invalid object" at the PRINT
#hPrinter line and the problem is on the rsAPOD!arithmosAp result which is
LongInteger (at the end of the PRINT line).
here is the code:
PUBLIC SUB Kataxwrisi_Click()
DIM hPrinter AS File
DIM $Result5 AS Result
DIM $ResultAPOD AS Result
DIM rsAPOD AS Result
DIM rsGRAMMI AS Result
DIM $ResultE5 AS Result
DIM TrexousaGrammi AS Long
DIM proigoumenos AS Long
MODMain.Connect
MODMain.$Con.Begin()
$Result5 = MODMain.$Con.Create("BiblioPortas")
$Result5!trexousaHmerominia = Date(Now)
$Result5!Poson = Val(TextBox2.Text)
$Result5.Update()
MODMain.$Con.Commit()
MODMain.Connect()
rsAPOD = MODMain.$Con.exec("select * from AApodixi order by
arithmosAp desc")
MODMain.$Con.Close
MODMain.Connect
MODMain.$Con.Begin()
$ResultE5 = MODMain.$Con.Create("Ektyposis")
$ResultE5.Update()
MODMain.$Con.Commit()
MODMain.Connect()
rsGRAMMI = MODMain.$Con.exec("select * from Ektyposis order by
Grammi desc")
TrexousaGrammi = rsGRAMMI!Grammi
MODMain.$Con.Close
hPrinter = OPEN "/dev/lp1" FOR OUTPUT
hPrinter.EndOfLine = gb.Windows
PRINT #hPrinter, "Anaxorisi" & " " & Format$(Date(Now), "dd.mm.yyyy") & "
A/A " & tArithmos.Text & " " & tEpitheto.Text & " " & tOnoma.Text & " " &
tEthnikotita.Text & " " & "Poson " & TextBox2.Text & " Ar.Apodixis " &
rsAPOD!arithmosAp
IF TrexousaGrammi MOD 55 = 0 THEN
PRINT #hPrinter, Chr$(12);
PRINT #hPrinter, " "
PRINT #hPrinter, " "
PRINT #hPrinter, " "
PRINT #hPrinter, " "
ENDIF
CLOSE hPrinter
MODMain.Connect
MODMain.$Con.Begin()
'MODMain.$Con.exec("UPDATE `pelates`.`egrafes` SET
`anaxwrisi` = '" & Date(Now) & "' WHERE `egrafes`.`AA` = '" & tArithmos.Text &
"' LIMIT 1 ")
MODMain.$Con.exec("UPDATE `pelates`.`egrafes` SET
`egrafes`.`epitheto` = '" & tEpitheto.Text &
"',........................................etc...................................',
`egrafes`.`timifix` = '" & CFloat(ttimifix.Text) & "' WHERE `egrafes`.`AA` =
'" & tArithmos.Text & "' LIMIT 1 ")
MODMain.$Con.exec("UPDATE `pelates`.`egrafes` SET
`egrafes`.`ekptosi` = '" & tekptosi.Text & "', `egrafes`.`elenchosAnax` = 1,
`egrafes`.`xreosi` =0, `egrafes`.`prokatavoli` = '" &
CFloat(tprokatavoli.Text) & "' WHERE `egrafes`.`AA` = '" & tArithmos.Text & "'
LIMIT 1 ")
MODMain.$Con.Close
MODMain.Connect
MODMain.$Con.Begin()
$ResultAPOD = MODMain.$Con.Create("AApodixi")
$ResultAPOD!Hmerominia = Date(Now)
$ResultAPOD!arithmosAp = rsAPOD!arithmosAp + 1
$ResultAPOD.Update()
MODMain.$Con.Commit()
ME.Close
END
More information about the User
mailing list