C# - Help with the DataTable.Select() method

Posted on 2009-04-18
Medium Priority
Last Modified: 2012-05-06
I've got a DataTable object and I'm trying to run the select method on it to get back an array of DataRows specific to the select string I'm passing in.  The select string that is being passed in  is...
Category = \"Business Expense\" AND Date = 3-09

It is contained within a variable strSelect and I execute my statement like this...
drSelected = dt.Select(strSelect);

I'm getting the following error:
Syntax error: Missing operand anfter 'Expense' operator.

Is my select string not well formed?  How would I need to set it up?
Question by:josephdaviskcrm
LVL 12

Accepted Solution

Nirmalan Nagenthiran earned 2000 total points
ID: 24175939

Use ' instead of double quote
try this way. Also check the date format
Category = 'Business Expense' AND Date = '3-09'

Open in new window


Author Closing Comment

ID: 31571817
That did it.  Thanks.

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Loops Section Overview
Suggested Courses

839 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