Insert error -- reckordset

[code] ’ ## SCORE –
'DIM intScore, intTotalScore as Integer
IF intStartPage = 1 THEN
intScore = 1
intTotalScore = intTotalScore + 1
END IF

    ' ##  INSERT LOG IF FOUND
    dr2.Column("strName") = str(arrSERP(0,j)) + " -- " + str(arrSERP(1,j))
    dr2.Column("dteCreatedDate") = d.shortDate
    dr2.Column("dteCreatedTime") = d.longTime
    dr2.Column("intBatchID") = str(intLastID)
    dr2.Column("strText") =  str(intStartPage / 10 + 1)
    dr2.Column("intScore") = intScore <------------------- ERROR
    dbDatabase.InsertRecord( "KATLog",dr2)[/code]

“Parameters are not compatible with this function”
I think the generic database is sort of difficult to work with.
However, I assume it’s my knowledge that’s the critical point…
I’m asking in the forum because maybe I’m doing more things wrong.

Use IntegerColumn, please.

Thank you!

' ## SCORE -- 'DIM intScore, intTotalScore as Integer IF intStartPage = 1 THEN intScore = 1 intTotalScore = intTotalScore + 1 END IF strStatus = "Score = " + str(intScore) + " -- total score = " + str(intTotalScore)

The score is not working.
This code is all in a thread. Is it the reason, it’s in a loop?

How would I solve it if not in a loop…? Any ideas…?

Both intScore and intTotalScore are Public Properties.

I am not sure if the code being in a thread is the problem, but generally that is bad for database. For example, what if 1 thread is using the database handle, starts a transaction and is interrupted by your thread now running which starts doing database inserts, then the other thread resumes and finishes out its transaction. That’s just an example of what could happen when sharing a database connection amongst threads, I’m not saying it’s what is going on in your case but something to think about.

All right. I can see the problem arising…!
My software only contain one thread and in this case I can ensure you there are no hidden threads beyond my control… :slight_smile:

The concern at the moment is the score. The simple score and the total score. This integer seem not to function as it should…
I shall try to look for a solution. It’s just that I’m running out of inspiration for possible solutions!! :slight_smile:

I now see other places within my app that Integers are not working as expected.
Is there some secrets surrounding Integers!?

So far I’ve solved it converting Integers to Strings. It works. But I think now, I’ve come to a point where I actually would prefer using Integers as Integers.

Are there some generic errors or solutions concerning Integers!? Or, simply me again…?

I’ve not had problems with Integers. I would set a break point in the debugger where you think things are getting messed up and step through the code watching its execution and values. I think Integers are a pretty stable part of Xojo.

Jakob, take a closer look at the info you’re giving us:

    ' ## SCORE -- 
    'DIM intScore, intTotalScore as Integer
    IF intStartPage = 1 THEN
      intScore = 1
      intTotalScore = intTotalScore + 1
    END IF
    strStatus = "Score = " + str(intScore) + " -- total score = " + str(intTotalScore)

The score is not working.

What do you mean “the score is not working?”

Did you try:

dr2.IntegerColumn(“intScore”) = intScore

as Christian suggested? Just saying “thank you” doesn’t make that clear.

[quote]Did you try:

dr2.IntegerColumn(“intScore”) = intScore

as Christian suggested? Just saying “thank you” doesn’t make that clear.[/quote]

Excuse me!! I tried and it worked!
I’m sorry for the short sentence… That part worked, absolutely!

There is some error with intStartPage…
I have to look at that tomorrow!!

Thank you for all advice this far!