Hi,
Following the Mysql Sample Project, how to do querying the data into listbox, based from textfield’s criteria,
this code still showing an error ’ unkown column ‘’ in where clause.
[code]
If Not IsConnected Then
MsgBox(“Connect to the database first.”)
End If
Dim sql As String
sql = “SELECT * FROM Team WHERE name =” + TextField5.Text
Dim data As RecordSet
data = mDB.SQLSelect(sql)
If mDB.Error Then
MsgBox("DB Error: " + mDB.ErrorMessage)
Return
End If
If data <> Nil Then
While Not data.EOF
DataList.AddRow(data.IdxField(1).StringValue, data.IdxField(2).StringValue, _
data.IdxField(3).StringValue, data.IdxField(4).StringValue)
What follows next is a long conversation about why this simplistic approach will cause you trouble in the long term.
Read up about parameterised queries.
Use Xojo to create a PREPARED STATEMENT using the database table schema data… this way you can have access to all the field names and build the PREPARED STATEMENT dynamically even if the table name or table schema changes
and the link you provided is JSQuery… not ANSI SQL