Dimitris Anogiatis ha scritto:
>  Vassili,
>
> Make sure there is data in the rsThesi!thesi field.
>
> Open a terminal, and login to mysql and do the Select statement from there
> and see if all the records have data on the thesi field.
>
> if not then you have to do something like this
>
> if isNull(rsThesi!thesi) = false then change_bgcolor("Label" &
> rsThesi!thesi)
>
> I hope this helps
>> I get error:
>> "Result is not available"
>> at line:
>> "change_bgcolor("Label" & rsThesi!thesi)"
>>
>> of the code:
>>
>> PUBLIC SUB Form_Open()
>>  DIM i AS Integer
>>  DIM rsThesi AS Result
>>     MODMain.Connect()
>>    rsThesi = MODMain.$Con.exec("select * from egrafes where elenchosAnax =
>> 0")
>>     rsThesi.MoveFirst
>>     WHILE rsThesi.Index < rsThesi.Count
>>      change_bgcolor("Label" & rsThesi!thesi)
>>       rsThesi.MoveNext
>>     WEND
>>    MODMain.$Con.Commit()
>> END
>>
>>     
There is something strange in here. If the SQL statement was incorrect, 
then an error should raise when executing it.
If the SQL returned an empty dataset, then rsThesi.Count should be 0, 
and rsThesi.Index should be 0 also. 0 is not less than 0, so the loop 
should not even execute... unless, on an empty dataset, Index is set to 
-1 (it would be *very* stupid). Try to test for data availability using 
rsThesi.Available, do some print (.Index, .count, .available) just 
before the loop. And let me know - I am curious...

If the dataset is not empty then the loop executes; if no field named 
"thesi" existed in table "engrafes", then the error "Result is not 
available" is misguiding.

Lastly, what is $con.Commit() for?

As Dimitris says, check the contents of your database using some tool 
(gambas database manager would be ok). Surely you will find something 
strange in there.

Regards,

-- 
Doriano Blengino

"Listen twice before you speak.
This is why we have two ears, but only one mouth."


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to