473,396 Members | 1,774 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,396 software developers and data experts.

Datatable.select correct syntax

sam
Why the folowing code generates ans error in the select expression ?:
DataRow[] drRows = dsRevues.Tables[0].Select("year >= '2000' && year <=
'2007'");//

What is the correct syntax ?

Sam
Aug 27 '07 #1
5 3876
Hi,

What error are you getting?

What type is the column "year" ?

If it's an integer just remove the ' around 2000 & 2007

"sam" <no**@none.frwrote in message
news:eC**************@TK2MSFTNGP05.phx.gbl...
Why the folowing code generates ans error in the select expression ?:
DataRow[] drRows = dsRevues.Tables[0].Select("year >= '2000' && year <=
'2007'");//

What is the correct syntax ?

Sam


Aug 27 '07 #2
Hi Sam
It should read
DataRow[] drRows = dsRevues.Tables[0].Select("year >= '2000' AND year <=
'2007'");

This is a more like SQL query, The MSDN for the select method has all the
allowed syntax you may need.

henk
"sam" <no**@none.frwrote in message
news:eC**************@TK2MSFTNGP05.phx.gbl...
Why the folowing code generates ans error in the select expression ?:
DataRow[] drRows = dsRevues.Tables[0].Select("year >= '2000' && year <=
'2007'");//

What is the correct syntax ?

Sam


Aug 27 '07 #3
sam
Year is a string. The problem was the &&. I have replace it with AND and it
works fine.
Thanks you for help.
sam

"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.coma écrit
dans le message de news: OR**************@TK2MSFTNGP04.phx.gbl...
Hi,

What error are you getting?

What type is the column "year" ?

If it's an integer just remove the ' around 2000 & 2007

"sam" <no**@none.frwrote in message
news:eC**************@TK2MSFTNGP05.phx.gbl...
>Why the folowing code generates ans error in the select expression ?:
DataRow[] drRows = dsRevues.Tables[0].Select("year >= '2000' && year <=
'2007'");//

What is the correct syntax ?

Sam



Aug 27 '07 #4
Hi,

"sam" <no**@none.frwrote in message
news:ut*************@TK2MSFTNGP05.phx.gbl...
Year is a string. The problem was the &&. I have replace it with AND and
it works fine.
Thanks you for help.
sam
Why are you keeping a column that represent year as a string?
Aug 27 '07 #5
sam
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote:
Why are you keeping a column that represent year as a string?
you are wright, but it is as is in the database I use.

sam
Aug 27 '07 #6

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

Similar topics

3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
0
by: gabyluna | last post by:
Hi, I´m trying to use the Select method for the DataTable objects of the System.Data library. The problem is that when the datatype of the object that's being searched is an string, I get the...
4
by: Randy | last post by:
I have a DataTable in a DataGrid. If I click on the DataGrid, HitTestInfo in dataGrid1_MouseDown returns a Row and Column number. I can use the Row number to say: DataRow dr = dataTable.Rows;...
9
by: Frank | last post by:
Hi, I use datatable.select to select row in a table in a dataset. I use an ampersand in the selectstring and get an error that it is unsupported. The statement works fine in the query analyzer of...
1
by: Diffident | last post by:
Hello All, I am trying to filter rows in a datatable based on filtercriteria and sortcriteria using the datatable.select() method. I am encountering a strange behavior in this process. Here is...
12
by: Doug Bell | last post by:
Hi, I am having problems trying to create a (temporary) DataTable from a selection from a DataGrid (dgOrders). dtOrdDetails is declared as a Public DataTable Sub is: Dim stFilter as String...
9
by: Anil Gupte | last post by:
After reading a tutorial and fiddling, I finally got this to work. I can now put two tables created with a DataTable class into a DataRelation. Phew! And it works! Dim tblSliceInfo As New...
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: ArunDhaJ | last post by:
Hi, I've to filter rows from DataTable Select There is a column named "Phone" which contains values in the following format: (901) 789 1234<BR>(901) 789 1235<BR>(901) 789 1221 I need 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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.