sql problem HELP!!!

mauri74doc

Member
Licensed User
Longtime User
Hello! I have a problem. I have a function where I run this code

Dim Cursor As dbcursor
Dim SQL As DBSQL

DBSql.Initialize (tDir, "database", True)

Dbcursor DBSql.ExecQuery = ("SELECT DISTINCT category FROM arguments")
If DBCursor.RowCount> 1 Then
Dim list (DBCursor.RowCount) As String
For x = 0 To DBCursor.RowCount - 1
DBCursor.Position = x
list (x) = DBCursor.GetString ("category")
Next

cmd_entra.Text = DBCursor.RowCount

last line I verify that the number of records read by the query corresponds to those of the database that enclose here.
when I debug I always returns the value of 4 records found rather than those actually present in my db as you can see. how can I solve this problem?
 

Attachments

  • database.zip
    555 bytes · Views: 150

mauri74doc

Member
Licensed User
Longtime User
Not sure that I understand. Where do the values come from if not from the database?
Not sure that I understand. Where do the values come from if not from the database?

if you open the db you can see that there are 8 record, in this case 5 records, with some repetition. So the result I expect is 5 (is an example) as I always return 4. I posted all the code of the function as it is a test, and since the problem I added another code
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Perhaps you altered your database locally (at your PC) and forgot to put the updated file at your device. There are ways to fix this, from programmatically setting the new database from dirAssets, up to manually transfering the file.
 
Upvote 0

mauri74doc

Member
Licensed User
Longtime User
You should post your project as a zip file just the database is not enough.

Best regards.


Dear Klaus, the zipped file of the whole folder goes beyond the limits imposed by the forum .. I could have let you in private? Give me your e-mail address? So I turn around and I'm sure you can solve the problem!
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I don't know what your problem is.
I tested the program and it works OK.
With DBCursor = DBSql.ExecQuery("SELECT DISTINCT categoria FROM argomenti")
I added a log to see the values and I get
0: null
1: Casa
2: Fuori casa
3: categoria 1
4: categoria 2
5: categoria 3

With DBCursor = DBSql.ExecQuery("SELECT categoria FROM argomenti")I get
0: Casa
1: Fuori casa
2: categoria 3
3: categoria 3
4: categoria 1
5: categoria 2
6: categoria 3
7: categoria 1
8: null
Thats exactly what you have in the database, where is the problem ! ?

Best regards.
 
Upvote 0
Top