Solved

SQL WHERE Greater than 0

Posted on 2014-03-23
5
191 Views
Last Modified: 2014-03-28
Hello,

I'm trying to create a query for vb.net connection string which will return values that are greater than 0. So far I have come up with this code of what I thought it was but I am stuck and cannot remember.

Select * From Products WHERE Pro_Qty > 0

Open in new window

0
Comment
Question by:lincstech
  • 3
5 Comments
 
LVL 19

Expert Comment

by:regmigrant
ID: 39948631
Assuming you have a table 'products' and that has a field 'pro_qty'  you have a valid sql statement - if some of those values than 0  you will get all the fields for that record.

what is your question?
0
 

Author Comment

by:lincstech
ID: 39948636
I get data type mismatch in criteria expression
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 39948638
Hi lincstech;

The SQL statement you posted in your question will return all rows whose column Pro_Qty contains a value greater then 0. Is that not what it is returning?

Are you getting an exception? If so please post the exception message exactly as it is returned as well an an inner exception message.

Please post the offending code as well.
0
 

Accepted Solution

by:
lincstech earned 0 total points
ID: 39948643
I figured it in the database I had the field type set to text instead of number. Got it working.
0
 

Author Closing Comment

by:lincstech
ID: 39961071
I noticed a field in the database which was changed from text to number which resolved the issue
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question