Dear visitor, welcome to Jabaco - Community.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
SQL statment - WHERE clause
Hi
Trying to get data out of a database using where clause but at no avail.
This simple example one works:
res = Database1.ExecuteStatement("SELECT * FROM INDEXDB1 WHERE IFIELD1='" & Text1.Text & "'")
but when using using the next example, does not work:
res = Database1.ExecuteStatement("SELECT * FROM INDEXDB1 WHERE IFIELD1 Like '" & Text1.Text & "'")
HELP
Please
Thank you
Hi,
you could try to display possible SQL warnings:
|
Source code
|
1
2
3
4
5
6
7
8
9
|
Dim sqlw As SQLWarning
...
rs = Database1.ExecuteStatement(query)
sqlw = Database1.Parent.getWarnings
If sqlw <> Null Then
MsgBox "SQL-Warning: " & sqlw.getMessage()
End If
|
What type of database are you using? MySql? SQL Server? Oracle?
Success!
A1880
Working now! Thank you
res = Database1.ExecuteStatement("SELECT * FROM INDEXDB1 WHERE IFIELD1 LIKE '%" & Text1.Text & "%'" )
replaced * with % and it works like a charm