Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Selecting rows from Table- VB.Net code behind

Posted on 2011-09-14
4
Medium Priority
?
255 Views
Last Modified: 2012-05-12
I retrieved a table from data base and want to retrieve rows from table in the vb.net code class
I tried the following line and it is giving the error.

ID,IsActive and displayorder are column names in the table.

Rows = TblLoanRates.Select("[ID] = "&1"  AND [IsActive] = "&1",displayorder ASC")

The error is: Comma,or a valid expression continuation expected.

Thanks.
0
Comment
Question by:KavyaVS
  • 2
4 Comments
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 1000 total points
ID: 36535871
Replace your double quotes for simple quotes (inside the where sentence), and separate the order sentence from the where sentence:

Rows = TblLoanRates.Select("[ID] = '&1'  AND [IsActive] = '&1'", "displayorder ASC")

Hope that helps.
0
 

Author Comment

by:KavyaVS
ID: 36538291
I tried your answer.It is giving following error.
EvaluateException was unhandled by user code.

Rows = TblLoanRates.Select("[ID] = '&1'  AND [IsActive] = '&1'", "displayorder ASC")

Cannot perform '=' operation on System.Int32 and System.String.

ID  and displayorder colums data type int.IsActive is bit type.

Please let me know how to fix it.
Thanks
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 1000 total points
ID: 36570580
Try this

Rows = TblLoanRates.Select("[ID] = " & 1 & "  AND [IsActive] = " & 1, "displayorder ASC")


0
 

Author Closing Comment

by:KavyaVS
ID: 36940289
Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

916 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