HELP: Wildcard won't work in WHERE (or THE WIERDEST BUG EVER) 
Author Message
 HELP: Wildcard won't work in WHERE (or THE WIERDEST BUG EVER)

I have a pretty severe problem with my SQL queries. Help if you can

I have Visual Basic 6 with SP3 on Windows '95and am building a SQL Database
Program (Food related). I use the ADO Data Control to pass SQL Queries to a
grid like so...

Dim SQL As String
SQL = "SELECT * FROM Abbrev WHERE (FoodName <> ' ')"
adoData.RecordSource = SQL

But when I try to pass a query like...

SELECT * FROM Abbrev WHERE (FoodName Like '*')
or
SELECT * FROM Abbrev WHERE (FoodName Like '*tter')
or
SELECT * FROM Abbrev WHERE (FoodName Like 'But?ter')

no rows are returned. However, if I input something like...

SELECT * FROM Abbrev WHERE (FoodName = 'Butter')
or
SELECT * FROM Abbrev WHERE (FoodName Like 'Butter')
or
SELECT * FROM Abbrev
or
SELECT * FROM Abbrev ORDER BY FoodName
or
(Basically anything without a wildcard in it)

it behaves normally.
Now we get even wierder. I used VisData (Visual Data Manager) to pass the
same queries, and it behaved the same, UNLESS I selected Use Data Control
instead of Use DataGrid, where it worked fine. I also used the VisData Query
Builder to check my queries. I even used Corel Database Desktop and got the
same output.

BUT THAT'S NOT ALL, FOLKS! When I pass queries that return at least one
record, the contents of the first cell of the first record of the first
field (In a spread-sheet, that's called A1) are deleted! that's easy to fix,
of course. I just set some attributes. But it's not supposed to work that
way.

        THE HALF-SOLUTION:
Now when I use VisData from VB4, it works like a charm, even on the same
system as VB6 is installed on. I've also installed VB6 on a fresh install of
Windows '98.

If you have the solution, PLEASE reply or E-Mail me at

Thank you so much,
    -Luke Abbott



Sun, 06 Oct 2002 03:00:00 GMT  
 HELP: Wildcard won't work in WHERE (or THE WIERDEST BUG EVER)
The wildcard character in ADO is %, not *

--

Doug Steele, Microsoft Access MVP
Beer, Wine and Database Programming. What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://I.Am/DougSteele/


Quote:
> I have a pretty severe problem with my SQL queries. Help if you can

> I have Visual Basic 6 with SP3 on Windows '95and am building a SQL
Database
> Program (Food related). I use the ADO Data Control to pass SQL Queries to
a
> grid like so...

> Dim SQL As String
> SQL = "SELECT * FROM Abbrev WHERE (FoodName <> ' ')"
> adoData.RecordSource = SQL

> But when I try to pass a query like...

> SELECT * FROM Abbrev WHERE (FoodName Like '*')
> or
> SELECT * FROM Abbrev WHERE (FoodName Like '*tter')
> or
> SELECT * FROM Abbrev WHERE (FoodName Like 'But?ter')

> no rows are returned. However, if I input something like...

> SELECT * FROM Abbrev WHERE (FoodName = 'Butter')
> or
> SELECT * FROM Abbrev WHERE (FoodName Like 'Butter')
> or
> SELECT * FROM Abbrev
> or
> SELECT * FROM Abbrev ORDER BY FoodName
> or
> (Basically anything without a wildcard in it)

> it behaves normally.

> Now we get even wierder. I used VisData (Visual Data Manager) to pass the
> same queries, and it behaved the same, UNLESS I selected Use Data Control
> instead of Use DataGrid, where it worked fine. I also used the VisData
Query
> Builder to check my queries. I even used Corel Database Desktop and got
the
> same output.

> BUT THAT'S NOT ALL, FOLKS! When I pass queries that return at least one
> record, the contents of the first cell of the first record of the first
> field (In a spread-sheet, that's called A1) are deleted! that's easy to
fix,
> of course. I just set some attributes. But it's not supposed to work that
> way.

>         THE HALF-SOLUTION:
> Now when I use VisData from VB4, it works like a charm, even on the same
> system as VB6 is installed on. I've also installed VB6 on a fresh install
of
> Windows '98.

> If you have the solution, PLEASE reply or E-Mail me at

> Thank you so much,
>     -Luke Abbott



Sun, 06 Oct 2002 03:00:00 GMT  
 HELP: Wildcard won't work in WHERE (or THE WIERDEST BUG EVER)
Thanks alot. Works like a charm now!

-Luke



Quote:
> The wildcard character in ADO is %, not *

> --

> Doug Steele, Microsoft Access MVP
> Beer, Wine and Database Programming. What could be better?
> Visit "Doug Steele's Beer and Programming Emporium"
> http://I.Am/DougSteele/



> > I have a pretty severe problem with my SQL queries. Help if you can

> > I have Visual Basic 6 with SP3 on Windows '95and am building a SQL
> Database
> > Program (Food related). I use the ADO Data Control to pass SQL Queries
to
> a
> > grid like so...

> > Dim SQL As String
> > SQL = "SELECT * FROM Abbrev WHERE (FoodName <> ' ')"
> > adoData.RecordSource = SQL

> > But when I try to pass a query like...

> > SELECT * FROM Abbrev WHERE (FoodName Like '*')
> > or
> > SELECT * FROM Abbrev WHERE (FoodName Like '*tter')
> > or
> > SELECT * FROM Abbrev WHERE (FoodName Like 'But?ter')

> > no rows are returned. However, if I input something like...

> > SELECT * FROM Abbrev WHERE (FoodName = 'Butter')
> > or
> > SELECT * FROM Abbrev WHERE (FoodName Like 'Butter')
> > or
> > SELECT * FROM Abbrev
> > or
> > SELECT * FROM Abbrev ORDER BY FoodName
> > or
> > (Basically anything without a wildcard in it)

> > it behaves normally.

> > Now we get even wierder. I used VisData (Visual Data Manager) to pass
the
> > same queries, and it behaved the same, UNLESS I selected Use Data
Control
> > instead of Use DataGrid, where it worked fine. I also used the VisData
> Query
> > Builder to check my queries. I even used Corel Database Desktop and got
> the
> > same output.

> > BUT THAT'S NOT ALL, FOLKS! When I pass queries that return at least one
> > record, the contents of the first cell of the first record of the first
> > field (In a spread-sheet, that's called A1) are deleted! that's easy to
> fix,
> > of course. I just set some attributes. But it's not supposed to work
that
> > way.

> >         THE HALF-SOLUTION:
> > Now when I use VisData from VB4, it works like a charm, even on the same
> > system as VB6 is installed on. I've also installed VB6 on a fresh
install
> of
> > Windows '98.

> > If you have the solution, PLEASE reply or E-Mail me at

> > Thank you so much,
> >     -Luke Abbott



Sun, 06 Oct 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Weirdest bug I've ever seen

2. simple ftp app developed on win98 won't work on win nt

3. VB6/ADODB/Access97 Wildcard in SQL doesn't work

4. can't get wildcards to work with MoveFolder

5. it compiles but won't work!! Help

6. moving to next page won't work, need help

7. Copying a Selection won't work - help!

8. Code won't work in template -- please help

9. Context-sensitive Help: won't work!

10. please help: VB app with ADODC won't work at Win98

11. Help! GetCursorPos won't work

12. Help - MAPI Interface won't work with Groupwise

 

 
Powered by phpBB® Forum Software