You are not logged in.

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.

HardDrive

Beginner

  • "HardDrive" is male
  • "HardDrive" started this thread

Posts: 12

Date of registration: Sep 22nd 2009

Location: London

Occupation: IT Consultant

Hobbies: inline skating, chess

  • Send private message

1

Tuesday, September 22nd 2009, 3:17pm

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

A1880

Intermediate

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

2

Tuesday, September 22nd 2009, 3:37pm

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

HardDrive

Beginner

  • "HardDrive" is male
  • "HardDrive" started this thread

Posts: 12

Date of registration: Sep 22nd 2009

Location: London

Occupation: IT Consultant

Hobbies: inline skating, chess

  • Send private message

3

Tuesday, September 22nd 2009, 5:29pm

Working now! Thank you

res = Database1.ExecuteStatement("SELECT * FROM INDEXDB1 WHERE IFIELD1 LIKE '%" & Text1.Text & "%'" )



replaced * with % and it works like a charm

Rate this thread
WoltLab Burning Board