473,395 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

DataTable.Select problem in ASP.NET 2.0

Hi,
I am having problem with DataTable.Select() method. I am using
ASP.NET 2.0.
I have DataSet which reads data from XML file using DataSet.ReadXML().
Now this
dataset has various datatable, created by XML file. I am taking one of
the datatable
from this dataset and want to filter on that datatable using Select()
method.
Now here the problem start, like when I pass multiple "And" clause in
this method
it doesnt recognize that parameter and doesnt return the value, where
as it should return the value.
For Example,

DataTable has various rows containing data, now when i try to filter
this data, then
it should return me data for the passed criteria. But to my surprise
its not doing like this.
Although I have that data which I am passing as filter expression in
Select Method(). This
method works for some criteria and it doesnt work for some criteria.

For example: -

dim dt as datatable = ds.Tables("Report")
drow = dt.Select("id = 1 and number=5 and value=10")
//basically this should return me datarow, but its not returning any
datarow and returns 0 as count.
//but the same line of code works for some of the values.

I am not able to figure out what could be the problem, is this a bug
from Microsoft, as it
was there in ASP.NET 1.1.

Please help me out, as i dont want to use DataView.RowFilter property

Aug 29 '06 #1
4 7096
I've used the Select method with some pretty complex criteria without
problems. I suspect something else is going on here, like the data isn't
what you think it is, etc.

You should try creating the datatable manually, adding the rows, setting the
values, then call Select on it. Something we can all run, and see if the
row isn't found.

"Aryan" <ma*********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Hi,
I am having problem with DataTable.Select() method. I am using
ASP.NET 2.0.
I have DataSet which reads data from XML file using DataSet.ReadXML().
Now this
dataset has various datatable, created by XML file. I am taking one of
the datatable
from this dataset and want to filter on that datatable using Select()
method.
Now here the problem start, like when I pass multiple "And" clause in
this method
it doesnt recognize that parameter and doesnt return the value, where
as it should return the value.
For Example,

DataTable has various rows containing data, now when i try to filter
this data, then
it should return me data for the passed criteria. But to my surprise
its not doing like this.
Although I have that data which I am passing as filter expression in
Select Method(). This
method works for some criteria and it doesnt work for some criteria.

For example: -

dim dt as datatable = ds.Tables("Report")
drow = dt.Select("id = 1 and number=5 and value=10")
//basically this should return me datarow, but its not returning any
datarow and returns 0 as count.
//but the same line of code works for some of the values.

I am not able to figure out what could be the problem, is this a bug
from Microsoft, as it
was there in ASP.NET 1.1.

Please help me out, as i dont want to use DataView.RowFilter property

Aug 29 '06 #2

"Aryan" <ma*********@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Hi,
I am having problem with DataTable.Select() method. I am using
ASP.NET 2.0.
I have DataSet which reads data from XML file using DataSet.ReadXML().
Now this
dataset has various datatable, created by XML file. I am taking one of
the datatable
from this dataset and want to filter on that datatable using Select()
method.
Now here the problem start, like when I pass multiple "And" clause in
this method
it doesnt recognize that parameter and doesnt return the value, where
as it should return the value.
For Example,

DataTable has various rows containing data, now when i try to filter
this data, then
it should return me data for the passed criteria. But to my surprise
its not doing like this.
Although I have that data which I am passing as filter expression in
Select Method(). This
method works for some criteria and it doesnt work for some criteria.

For example: -

dim dt as datatable = ds.Tables("Report")
drow = dt.Select("id = 1 and number=5 and value=10")
//basically this should return me datarow, but its not returning any
datarow and returns 0 as count.
//but the same line of code works for some of the values.

I am not able to figure out what could be the problem, is this a bug
from Microsoft, as it
was there in ASP.NET 1.1.

Please help me out, as i dont want to use DataView.RowFilter property
The data in your table probably isn't in integer form. Depends on you xml
schema if you have one. If not they are probably all text type. Depending on
how much you are using the data you might also want to look into serializing
your xml and putting the data into a class that inherits the arraylist. This
article may be of some assistants (read part one and two).
http://aspnet.4guysfromrolla.com/articles/102302-1.aspx

Mike
Aug 29 '06 #3
This should say strongly typed class not serialized. Sorry.
Mike

The data in your table probably isn't in integer form. Depends on you xml
schema if you have one. If not they are probably all text type. Depending
on
how much you are using the data you might also want to look into
serializing
your xml and putting the data into a class that inherits the arraylist.
This
article may be of some assistants (read part one and two).
http://aspnet.4guysfromrolla.com/articles/102302-1.aspx

Mike


Aug 29 '06 #4
Hi,
I am not able to understand one thing, if I have that data in
DataTable's Data Visualiser when I am in debug mode, then how can I am
not able to search for the same data using Select method. In normal
case, it should not show me that data in Visualiser which I am looking
for, or there is something worng with this case, like I can see the
data in Data Visualiser but I am not able to perform search on same
data using DataTable.Select() method.

Please suggest me how can this happen???

Thanks & Regards,
Manoj Singh

Aug 30 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Luc | last post by:
I am using Visual Studio 2003 and am getting lousy performance after using a datatable select and then trying to assign a value to a column of the row that was found: DataTable dt = new...
4
by: Kris Rudin | last post by:
I am displaying a table of information on a web page, using an asp:table that I populate dynamically. On this page I give the user the options to group the rows by certain fields, and/or filter the...
2
by: Marcel Hug | last post by:
Hi NG! With a Inner-Join SQL I get my datas in a DataSet. In the table are the column Entry and Version. Like this: Entry Version 1 1 1 2 1 ...
7
by: wk6pack | last post by:
Hi, How do I check datatable.select(filter) in the following: for each dtrow in datatable.select(filter) .... next I've also tried:
1
by: Maxwell2006 | last post by:
Hi, I am working with strongly typed datatables. What is the most efficient way to build a new DataTAble based on the result of DataTable.Select? At this point I use a foreach loop to do the...
5
by: Manikandan | last post by:
Hi, I have a datatable with rows. When I used datatable.select with values it is working properly, But when I use the select with variables it is not working. I tried with putting '(single...
4
by: Massimo | last post by:
Hi to All, i'm using C# in .NET 2.0 and i have a DataTable A with a column of type TimeSpan used to store HOUR info. I'm trying to filter my DataTable A selecting only rows that have the column...
3
by: Jeff | last post by:
hey ..NET 2.0 I have a datatable which consist of 3 columns (int, date, value). This DataTable have 3 rows, the values of the "date" ("date" column is of datetime datatype) column is:...
3
by: Nuno Magalhaes | last post by:
Hello, I have a DataTable in which the items are of type MyClass. How can I use Select to compare a MyClass instance with the DataTable? Is there any overriden method (like the ToString()) to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.