-
I have this ado data control and a datagrid
The SQL Statement is something like this
SQLString = "SELECT * FROM Main WHERE Name LIKE ('*John*')"
when the display button is clicked, the following statements are executed,
frmDBGrid.Adodc1.CommandType = adCmdText
frmDBGrid.Adodc1.RecordSource = SQLString
frmDBGrid.Adodc1.Refresh
frmDBGrid.DataGrid1.SetFocus
But it seems like the ado data control has no record in it, when there should be.
-
Your SQl should look like this:
Code:
SQLString = "SELECT * FROM Main WHERE Name LIKE '*John*';"
and it will search for all record that have any character either before or after John.
-
I've tried the following SQL statement..
but it's still not working.
the ado data control is greyed out. (meaning no recordset?)
-
Just make sure there is a data with "John" in the Name field. If yes, then try to change the field name Name to other like MyName. Because i affraid it conflict with the system reserve word.
-
heh
thanks Chris and others who have helped me out..
btw, I can't remember who's that..
but someone posted the solution on the forum..
i should have change the wildcard * to %
as in "Name LIKE ('*John*')" to "Name LIKE ('%John%')"
think maybe it's becoz I used adodc ...
if i've used coding instead... think * will work as well..
coz it actually worked in the first place...
anyway, thanks..
btw, how do I close a thread?