PC Review


Reply
Thread Tools Rate Thread

DataTable.Select question

 
 
Roy
Guest
Posts: n/a
 
      22nd Apr 2009
I have a DataTable with a column named "MyColumn (Something)". When I use the
following code to select the column with a value of "abc"

string filter = "MyColumn (Something)" + "=abc";
MyDataTable.Select(filter)

It shows an error:
"The expression contains undefined function call MyColumn().".

How do I let the Select() function know the "MyColumn (Something)" is the
title of the column, not a function?
 
Reply With Quote
 
 
 
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      23rd Apr 2009
Roy,

Is the columname MyColumn(Something)

or is it

MyColumn indexed by something.

This question is never made in the Select, therefore you stated that your
columname is MyColumn(Something)

Did you really made in your database a column with that name?

Cor

"Roy" <(E-Mail Removed)> wrote in message
news:6794C97B-F200-4CE9-9ED7-(E-Mail Removed)...
>I have a DataTable with a column named "MyColumn (Something)". When I use
>the
> following code to select the column with a value of "abc"
>
> string filter = "MyColumn (Something)" + "=abc";
> MyDataTable.Select(filter)
>
> It shows an error:
> "The expression contains undefined function call MyColumn().".
>
> How do I let the Select() function know the "MyColumn (Something)" is the
> title of the column, not a function?


 
Reply With Quote
 
Miha Markic
Guest
Posts: n/a
 
      23rd Apr 2009
> Did you really made in your database a column with that name?

I am curious as well :-)

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: blog.rthand.com
 
Reply With Quote
 
Srinidhi
Guest
Posts: n/a
 
      25th Apr 2009
Try enclosing the colum name in square brackets "[MyColumn (Something)]"
that could work
"Roy" <(E-Mail Removed)> wrote in message
news:6794C97B-F200-4CE9-9ED7-(E-Mail Removed)...
>I have a DataTable with a column named "MyColumn (Something)". When I use
>the
> following code to select the column with a value of "abc"
>
> string filter = "MyColumn (Something)" + "=abc";
> MyDataTable.Select(filter)
>
> It shows an error:
> "The expression contains undefined function call MyColumn().".
>
> How do I let the Select() function know the "MyColumn (Something)" is the
> title of the column, not a function?



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on DataTable.Select Wan Microsoft VB .NET 1 5th Jan 2007 06:01 AM
Retrieving datarows using DataTable.Select method and adding it to new DataTable C.Anand via DotNetMonster.com Microsoft ADO .NET 4 4th Apr 2005 05:21 PM
Question on DataTable.Select() =?Utf-8?B?RGlmZmlkZW50?= Microsoft ASP .NET 1 31st Mar 2005 12:44 AM
DataTable.Select question Mika M Microsoft ADO .NET 4 10th Mar 2005 01:12 AM
How can I use real SQL on a DataTable? i.e. not array of rows using a filter... as in DataTable.Select Dan V. Microsoft C# .NET 3 1st Jul 2004 03:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:20 PM.