P parijs Active Member Licensed User Longtime User Nov 5, 2014 #1 What am I doing wrong ? Code: Copy oRst = SQL.ExecQuery2("SELECT * FROM Bustrip ORDER BY sort Asc WHERE bus = ?", Array As String (Main.find))
What am I doing wrong ? Code: Copy oRst = SQL.ExecQuery2("SELECT * FROM Bustrip ORDER BY sort Asc WHERE bus = ?", Array As String (Main.find))
P parijs Active Member Licensed User Longtime User Nov 5, 2014 #3 Oke but whats wrong now? Code: Copy oRst = SQL.ExecQuery2("SELECT * FROM Bustrip WHERE bus = ?", Array As String (Main.find) ORDER BY sort Asc) Upvote 0
Oke but whats wrong now? Code: Copy oRst = SQL.ExecQuery2("SELECT * FROM Bustrip WHERE bus = ?", Array As String (Main.find) ORDER BY sort Asc)
mc73 Well-Known Member Licensed User Longtime User Nov 5, 2014 #4 parijs said: Oke but whats wrong now? Code: Copy oRst = SQL.ExecQuery2("SELECT * FROM Bustrip WHERE bus = ?", Array As String (Main.find) ORDER BY sort Asc) Click to expand... Code: Copy oRst = SQL.ExecQuery2("SELECT * FROM Bustrip WHERE bus = ? ORDER BY sort Asc", ArrayAsString (Main.find) ) By the way, [sort] is a field? If not, place the field you want instead of it. Upvote 0
parijs said: Oke but whats wrong now? Code: Copy oRst = SQL.ExecQuery2("SELECT * FROM Bustrip WHERE bus = ?", Array As String (Main.find) ORDER BY sort Asc) Click to expand... Code: Copy oRst = SQL.ExecQuery2("SELECT * FROM Bustrip WHERE bus = ? ORDER BY sort Asc", ArrayAsString (Main.find) ) By the way, [sort] is a field? If not, place the field you want instead of it.
P parijs Active Member Licensed User Longtime User Nov 5, 2014 #5 Thanks MC Yes sort is a field Now its order like 1,10,11 .....2,20 Is there a solution? Upvote 0
Jmu5667 Well-Known Member Licensed User Longtime User Nov 5, 2014 #6 Hi, if bustrip is a string then the sort order is correct, if bustrip is always a number then define it as a int/long etc. Upvote 0
Hi, if bustrip is a string then the sort order is correct, if bustrip is always a number then define it as a int/long etc.
P parijs Active Member Licensed User Longtime User Nov 5, 2014 #7 I changed it to int and works thanks Upvote 0
Jmu5667 Well-Known Member Licensed User Longtime User Nov 5, 2014 #8 Great, glad to be of help Upvote 0
M Mahares Expert Licensed User Longtime User Nov 5, 2014 #9 parijs says: I changed it to int and works Click to expand... Please note that you did not have to change the field data type from TEXT to INTEGER to get the proper sort. If you have a field named Sort that is of TEXT type in a table, but contains all integers, you do not have to change the field data type in the table to INTEGER. You can always sort using the CAST function like this: ORDER BY CAST(Sort AS INTEGER). The records will be sorted properly. Upvote 0
parijs says: I changed it to int and works Click to expand... Please note that you did not have to change the field data type from TEXT to INTEGER to get the proper sort. If you have a field named Sort that is of TEXT type in a table, but contains all integers, you do not have to change the field data type in the table to INTEGER. You can always sort using the CAST function like this: ORDER BY CAST(Sort AS INTEGER). The records will be sorted properly.