Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Datatable select method to select date

Posted on 2006-05-08
7
Medium Priority
?
3,375 Views
Last Modified: 2009-12-16
I have a datatable that contain column of data type datetime.

for example:
i have a column name 'Ndate' that have datavalue '03-29-2006 12:00:00AM'

i want to select rows that 'Ndate' is '03/29/2006'.

Could anyone pls tell me how can i select it using datatable.select method..?
0
Comment
Question by:A91627
4 Comments
 
LVL 7

Expert Comment

by:davidrichardson
ID: 16628627
0
 

Author Comment

by:A91627
ID: 16628859
Sorry. Allow me to make me clear...

Actually i want to select date only from date time column.

For example:

column [Date]
'03/29/2006 12:00:00A.M'

and i want to select it date only like
'03/29/2006'


is there any way like convert datetime to date only or select date only in datatable.select method..?

I have tried datatable.select("Convert(date, Varchar)"), but the result is a error message like this :
'Invalid datatype Varchar'

0
 
LVL 9

Accepted Solution

by:
tolgaong earned 500 total points
ID: 16629125
dt.Select("[date] = #2006-03-29#)
should give you what you want.
0
 
LVL 34

Assisted Solution

by:Sancler
Sancler earned 500 total points
ID: 16629328
Or, if tolgaong's suggestion doesn't work (I haven't tried it), see this

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21545297.html#14790339

That concerns a DataView .RowFilter, but the same expression rules apply to DataTable .Select.

Roger
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

581 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