Hello, since i updatet from gb.db to db.db2 the order by in the sql statement dont work anymore, what i have to change?
I have also the problem, when i have a combobox and i open the popup (in the combobox), select a entry and then i enter in the field a text, the keypress event is not working, until i put the focus to another control and then i go back. The same problem i have in the IDE, from time to time, i need to select again the module or class, otherwise the keyboard is not working. I have this issue on Ubuntu 24.04 and on Ubuntu 24.10 (x86_64 and arm64). Anyone a idea what is the problem?
Thanks
gb.db2 Order by
Re: gb.db2 Order by
I'll leave the database problem to those with better knowledge on that subject.
Regarding your "Click" problem, try Public Sub ComboBox1_Activate() not Public Sub ComboBox1_Click(). I think that will help you.
Regarding your "Click" problem, try Public Sub ComboBox1_Activate() not Public Sub ComboBox1_Click(). I think that will help you.
Re: gb.db2 Order by
Thanks, sorry i wrote wrong, key_release is not working, key_press works.
Re: gb.db2 Order by
give us an example of how you are doing the order by query.
I have had no problems at all with db2,
b
I have had no problems at all with db2,
b
-
- Legend
- Posts: 2110
- Joined: Thu Jul 23, 2020 5:20 pm
- Location: Isle of Wight
Re: gb.db2 Order by
I do not get any key_release issues with combobox
But I often find i have typed something in a class/module but it did not appear because the editor was not focused and i have to click on the document to use the keyboard.
This happens sometimes after hitting the "run" button to test a program. (and possibly other IDE forms opening then closing)
It's simply (annoyingly) after a test run the editor does not regain focus and needs to be clicked.
It maybe a toolkit issue , try the IDE (and your program) with QT and see if it still happens.
env GB_GUI=gb.gui.qt gambas3
But I often find i have typed something in a class/module but it did not appear because the editor was not focused and i have to click on the document to use the keyboard.
This happens sometimes after hitting the "run" button to test a program. (and possibly other IDE forms opening then closing)
It's simply (annoyingly) after a test run the editor does not regain focus and needs to be clicked.
It maybe a toolkit issue , try the IDE (and your program) with QT and see if it still happens.
env GB_GUI=gb.gui.qt gambas3
Re: gb.db2 Order by
Public Function ImportDB(sTable As String, sField1 As String, sField2 As String, Optional sWhere As String) As Boolean
Dim Res As Result
Dim sSql As String = DB.Subst("SELECT * FROM &1 ORDER BY '&2' ", sTable, sField1)
If sWhere <> "" Then
ssql = db.Subst("SELECT * FROM &1 " & sWhere & " ORDER BY '&2' ", sTable, sField1)
Endif
With gb.db works, but with gb.db2 not.
Re: gb.db2 Order by
Today Key_Press don't work with Key.UP and Key.DOWN, i need to put the code in Key_Release to work? after Key_Release is worked out the Click Event is fired??.
I have a combobox with there i search in a gridlist the data, with up and down i scroll the gridlist.
I have a combobox with there i search in a gridlist the data, with up and down i scroll the gridlist.
Public Sub cbosearch_KeyRelease()
' Message(Key.Code)
If mGridlist.aList.Count = 0 Then Return
Dim iIndex As Integer
For i As Integer = 0 To GridList.Rows.Count - 1
If GridList.Rows[i].Selected Then
iindex = i
i = GridList.Rows.Count - 1
Endif
Next
Select Case Key.Code
Case Key.Enter, Key.Return 'Enter
iIndex = mGridlist.FindIndexofText(cboSearch.Text)
If iindex = -1 Then Return
GridList.Scroll(0, GridList.Current.Y)
Dim Result As String = GridList.Current.Text
cbosearch.Text = Result
'Show Record
If GridList.Row = -1 Then Return
GridSelected(GridList[GridList.Row, 0].Text)
Return
Case Key.Up
If iindex > 1 Then
iindex = iindex - 1
GridList.Row = iindex
GridList.Scroll(0, GridList.Current.Y)
Result = GridList.Current.Text
cbosearch.Text = Result
Return
Re: gb.db2 Order by
Hello, I am not an expert, but I am currently experimenting with an SQL database.
So far I have no problems with gb.db2
But I immediately notice something in your code.
You have not quoted correctly in db.Subst.
If you want to substitute a table name, you have to put it in square brackets.
See https://gambaswiki.org/wiki/doc/db-quoting
"If a substitution pattern in enclosed with square brackets, then the argument is supposed to be a table name, and the Connection.Quote method is used to correctly quote the table name into the result string. "
so you have to write
Code: Select all
ssql = db.Subst("SELECT * FROM [&1]" & sWhere & "ORDER BY '&2' ", sTable, sField1)
Best regards
Poly
- Quincunxian
- Regular
- Posts: 199
- Joined: Sun Jun 25, 2017 12:14 am
- Location: Western Australia
- Contact:
Re: gb.db2 Order by
Hi Poly,
Just a best practice thing - I'd recommend NOT using the name 'sWHERE' as a variable as it's a SQL key word and it makes it somewhat confusing when you look at the statement.
Can you give me an example of what you would pass in sWhere please, as I can't quite make sense of your SQL statement.
I'm not an expert but I do write a lot of MySql / SQLite based applications in Gambas.
Just a best practice thing - I'd recommend NOT using the name 'sWHERE' as a variable as it's a SQL key word and it makes it somewhat confusing when you look at the statement.
Can you give me an example of what you would pass in sWhere please, as I can't quite make sense of your SQL statement.
I'm not an expert but I do write a lot of MySql / SQLite based applications in Gambas.
Cheers - Quin.
I code therefore I am
I code therefore I am
Re: gb.db2 Order by
This is a perfect example of what happens when the original post contains two questions!