[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 291
  • Last Modified:

SQL statement in VB

Hello,
I've written the following SQL statement:

SELECT Students.*
FROM Students
WHERE (Student_ID LIKE '1*')

It works in a query in MS-Access, but when I use THE SAME statment in VB (I use Data-Environment) it doesn't work. Why??

I have tried to use "[Student_ID]" instead of "Student_ID", "*" instead of "Students.*" etc... Nothing helped.

Any ideas?

P.S.  I will increase points if I get an answer shortly!!!
0
slavikn
Asked:
slavikn
1 Solution
 
frankdCommented:
I would try this:

WHERE (Student_ID LIKE '1%')


I've always used % for the wildcard in SQL

Hope this helps

Frank
0
 
rspahitzCommented:
frankd is correct.  Access is a strange beast that tries to use the Microsoft standards internally (where "*" is a wildcard) but uses the SQL standard externally (where "%" is a wildcard.)
0
 
toys032498Commented:


Also what your datatypes.
If STUDENT_ID is an int

Then
WHERE (convert(varchar(10), Student_ID) LIKE '1%')
OR
WHERE (Student_ID > 1)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
slaviknAuthor Commented:
toys, I the field is of String type. Anyway, I've already got the answer...
0
 
slaviknAuthor Commented:
Thank you very much! This really helped. I also increased the point to 115 (instead of 100) as I'd promised. I simply need them for future questions.
0
 
slaviknAuthor Commented:
0
 
frankdCommented:
slavikn,

Thanks for the points, I'm glad I was able to help.

Frank
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now