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

Filter datatable on date field on server pc problem

Hi,

i have a client program that sends a filter expression to the server PC. On
that server PC this filter is put over a datatable and the result is send
back.

the server can be located on a PC with let's say ddmmyyyy windows date
format and the client has mmddyyyy.

when the filter expression send is "Date < #31/01/2003#", it will fail on
the server because the format for day and month is different.

is there a generic way to send a filter expression used with the
DataTable.Select command so that it works always whatever the windows
setting is?

or should i get the default windows date format from the server, send it to
the client which it should use?

thanks.
Nov 15 '05 #1
6 3284
Hi Willie,

IF you cannot control the way that each part of the application you then
need to transform it on something generic, like a Tick, can you send the
data from the client to the server as a Tick ( this is defined as long ) ?
If so you could do this in the client:
DateTime.Ticks

and in the server:
new DateTime( tickCount )

in this way you don't care how the datetime is represented on the client or
on the server.

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Willie wjb" <wj****@nomail.nl> wrote in message
news:uY**************@TK2MSFTNGP11.phx.gbl...
Hi,

i have a client program that sends a filter expression to the server PC. On that server PC this filter is put over a datatable and the result is send
back.

the server can be located on a PC with let's say ddmmyyyy windows date
format and the client has mmddyyyy.

when the filter expression send is "Date < #31/01/2003#", it will fail on
the server because the format for day and month is different.

is there a generic way to send a filter expression used with the
DataTable.Select command so that it works always whatever the windows
setting is?

or should i get the default windows date format from the server, send it to the client which it should use?

thanks.

Nov 15 '05 #2
the problem i have is that the client program is a sdk. So each user can
define it own where clauses...

does anybody know if the date format used by ado.net is restricted to US
format MM/dd/yyyy hh:mm:ss

i am doing several tests on different machines and found out that ado.net
only works with this US format, even on german pc's.

But when using i must be 100% sure that is behaves this way, and i can not
find any info for this on msdn.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:uH**************@TK2MSFTNGP11.phx.gbl...
Hi Willie,

IF you cannot control the way that each part of the application you then
need to transform it on something generic, like a Tick, can you send the
data from the client to the server as a Tick ( this is defined as long ) ?
If so you could do this in the client:
DateTime.Ticks

and in the server:
new DateTime( tickCount )

in this way you don't care how the datetime is represented on the client or on the server.

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Willie wjb" <wj****@nomail.nl> wrote in message
news:uY**************@TK2MSFTNGP11.phx.gbl...
Hi,

i have a client program that sends a filter expression to the server PC.

On
that server PC this filter is put over a datatable and the result is send back.

the server can be located on a PC with let's say ddmmyyyy windows date
format and the client has mmddyyyy.

when the filter expression send is "Date < #31/01/2003#", it will fail on the server because the format for day and month is different.

is there a generic way to send a filter expression used with the
DataTable.Select command so that it works always whatever the windows
setting is?

or should i get the default windows date format from the server, send it

to
the client which it should use?

thanks.


Nov 15 '05 #3

"Willie wjb" <wj****@nomail.nl> wrote in message
news:u7**************@TK2MSFTNGP11.phx.gbl...
the problem i have is that the client program is a sdk. So each user can
define it own where clauses...

does anybody know if the date format used by ado.net is restricted to US
format MM/dd/yyyy hh:mm:ss
For jet sql data litereals #...# must always be in US format.

i am doing several tests on different machines and found out that ado.net
only works with this US format, even on german pc's.
You can use the function DateValue which is aware of international settings
in windows :

"SELECT * FROM tblTest WHERE test > DateValue('12/3/03')"

Hope this helps
greetings

But when using i must be 100% sure that is behaves this way, and i can not
find any info for this on msdn.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote in message news:uH**************@TK2MSFTNGP11.phx.gbl...
Hi Willie,

IF you cannot control the way that each part of the application you then
need to transform it on something generic, like a Tick, can you send the
data from the client to the server as a Tick ( this is defined as long ) ? If so you could do this in the client:
DateTime.Ticks

and in the server:
new DateTime( tickCount )

in this way you don't care how the datetime is represented on the client

or
on the server.

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Willie wjb" <wj****@nomail.nl> wrote in message
news:uY**************@TK2MSFTNGP11.phx.gbl...
Hi,

i have a client program that sends a filter expression to the server
PC. On
that server PC this filter is put over a datatable and the result is send back.

the server can be located on a PC with let's say ddmmyyyy windows date
format and the client has mmddyyyy.

when the filter expression send is "Date < #31/01/2003#", it will fail on the server because the format for day and month is different.

is there a generic way to send a filter expression used with the
DataTable.Select command so that it works always whatever the windows
setting is?

or should i get the default windows date format from the server, send

it to
the client which it should use?

thanks.



Nov 15 '05 #4
ado.net does not contain a DateValue function

i use the rowfilter on a datatable that is in memory, no jet or sql
connection.

"BMermuys" <bm**************@hotmail.com> wrote in message
news:%x*********************@phobos.telenet-ops.be...

"Willie wjb" <wj****@nomail.nl> wrote in message
news:u7**************@TK2MSFTNGP11.phx.gbl...
the problem i have is that the client program is a sdk. So each user can
define it own where clauses...

does anybody know if the date format used by ado.net is restricted to US
format MM/dd/yyyy hh:mm:ss
For jet sql data litereals #...# must always be in US format.

i am doing several tests on different machines and found out that ado.net
only works with this US format, even on german pc's.


You can use the function DateValue which is aware of international

settings in windows :

"SELECT * FROM tblTest WHERE test > DateValue('12/3/03')"

Hope this helps
greetings

But when using i must be 100% sure that is behaves this way, and i can not find any info for this on msdn.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:uH**************@TK2MSFTNGP11.phx.gbl...
Hi Willie,

IF you cannot control the way that each part of the application you then need to transform it on something generic, like a Tick, can you send the data from the client to the server as a Tick ( this is defined as long ) ?
If so you could do this in the client:
DateTime.Ticks

and in the server:
new DateTime( tickCount )

in this way you don't care how the datetime is represented on the
client or
on the server.

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Willie wjb" <wj****@nomail.nl> wrote in message
news:uY**************@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> i have a client program that sends a filter expression to the server PC. On
> that server PC this filter is put over a datatable and the result is send
> back.
>
> the server can be located on a PC with let's say ddmmyyyy windows
date > format and the client has mmddyyyy.
>
> when the filter expression send is "Date < #31/01/2003#", it will fail on
> the server because the format for day and month is different.
>
> is there a generic way to send a filter expression used with the
> DataTable.Select command so that it works always whatever the

windows > setting is?
>
> or should i get the default windows date format from the server,

send it to
> the client which it should use?
>
> thanks.
>
>



Nov 15 '05 #5
Hi,
[inline]

"Willie wjb" <wj****@nomail.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
ado.net does not contain a DateValue function

i use the rowfilter on a datatable that is in memory, no jet or sql
connection.
I don't know if this helps you much, but here are some conversions methods
that might give you some ideas As you already know, there is no way to
tell which format a date is in if the day is less or equal to 12. So
ussally the sender of the date converts the date to a fixed format or
specifies what the format is.

static string LocalToUS(string local)
{
System.Globalization.CultureInfo usc =
new System.Globalization.CultureInfo("en-US");

// default parsing uses current culture (local format)
DateTime dt = DateTime.Parse(local);

return dt.ToString(usc.DateTimeFormat.ShortDatePattern);
}

static string USToLocal(string us)
{
System.Globalization.CultureInfo usc =
new System.Globalization.CultureInfo("en-US");

DateTime dt = DateTime.Parse(us, usc);

return dt.ToString(System.Globalization.CultureInfo.
CurrentCulture.DateTimeFormat.ShortDatePattern);
}

Greetings


"BMermuys" <bm**************@hotmail.com> wrote in message
news:%x*********************@phobos.telenet-ops.be...

"Willie wjb" <wj****@nomail.nl> wrote in message
news:u7**************@TK2MSFTNGP11.phx.gbl...
the problem i have is that the client program is a sdk. So each user can define it own where clauses...

does anybody know if the date format used by ado.net is restricted to US format MM/dd/yyyy hh:mm:ss


For jet sql data litereals #...# must always be in US format.

i am doing several tests on different machines and found out that ado.net only works with this US format, even on german pc's.


You can use the function DateValue which is aware of international

settings
in windows :

"SELECT * FROM tblTest WHERE test > DateValue('12/3/03')"

Hope this helps
greetings

But when using i must be 100% sure that is behaves this way, and i can not find any info for this on msdn.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>

wrote
in message news:uH**************@TK2MSFTNGP11.phx.gbl...
> Hi Willie,
>
> IF you cannot control the way that each part of the application you

then
> need to transform it on something generic, like a Tick, can you send the > data from the client to the server as a Tick ( this is defined as long )
?
> If so you could do this in the client:
> DateTime.Ticks
>
> and in the server:
> new DateTime( tickCount )
>
> in this way you don't care how the datetime is represented on the client or
> on the server.
>
> Hope this help,
>
> --
> Ignacio Machin,
> ignacio.machin AT dot.state.fl.us
> Florida Department Of Transportation
>
> "Willie wjb" <wj****@nomail.nl> wrote in message
> news:uY**************@TK2MSFTNGP11.phx.gbl...
> > Hi,
> >
> > i have a client program that sends a filter expression to the server PC.
> On
> > that server PC this filter is put over a datatable and the result
is send
> > back.
> >
> > the server can be located on a PC with let's say ddmmyyyy windows

date > > format and the client has mmddyyyy.
> >
> > when the filter expression send is "Date < #31/01/2003#", it will fail on
> > the server because the format for day and month is different.
> >
> > is there a generic way to send a filter expression used with the
> > DataTable.Select command so that it works always whatever the windows > > setting is?
> >
> > or should i get the default windows date format from the server,

send
it
> to
> > the client which it should use?
> >
> > thanks.
> >
> >
>
>



Nov 15 '05 #6
this one also passed my mind.
turn the server application into a english by changing the culture for it,
and tell the clients to use always the english format.

Thanks for your help.

"BMermuys" <bm**************@hotmail.com> wrote in message
news:tq*********************@phobos.telenet-ops.be...
Hi,
[inline]

"Willie wjb" <wj****@nomail.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
ado.net does not contain a DateValue function

i use the rowfilter on a datatable that is in memory, no jet or sql
connection.
I don't know if this helps you much, but here are some conversions methods
that might give you some ideas As you already know, there is no way to
tell which format a date is in if the day is less or equal to 12. So
ussally the sender of the date converts the date to a fixed format or
specifies what the format is.

static string LocalToUS(string local)
{
System.Globalization.CultureInfo usc =
new System.Globalization.CultureInfo("en-US");

// default parsing uses current culture (local format)
DateTime dt = DateTime.Parse(local);

return dt.ToString(usc.DateTimeFormat.ShortDatePattern);
}

static string USToLocal(string us)
{
System.Globalization.CultureInfo usc =
new System.Globalization.CultureInfo("en-US");

DateTime dt = DateTime.Parse(us, usc);

return dt.ToString(System.Globalization.CultureInfo.
CurrentCulture.DateTimeFormat.ShortDatePattern);
}

Greetings


"BMermuys" <bm**************@hotmail.com> wrote in message
news:%x*********************@phobos.telenet-ops.be...

"Willie wjb" <wj****@nomail.nl> wrote in message
news:u7**************@TK2MSFTNGP11.phx.gbl...
> the problem i have is that the client program is a sdk. So each user can > define it own where clauses...
>
> does anybody know if the date format used by ado.net is restricted to US
> format MM/dd/yyyy hh:mm:ss

For jet sql data litereals #...# must always be in US format.

>
> i am doing several tests on different machines and found out that ado.net
> only works with this US format, even on german pc's.

You can use the function DateValue which is aware of international

settings
in windows :

"SELECT * FROM tblTest WHERE test > DateValue('12/3/03')"

Hope this helps
greetings

>
> But when using i must be 100% sure that is behaves this way, and i
can
not
> find any info for this on msdn.
>
>
> "Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT
dot.state.fl.us> wrote
> in message news:uH**************@TK2MSFTNGP11.phx.gbl...
> > Hi Willie,
> >
> > IF you cannot control the way that each part of the application you then
> > need to transform it on something generic, like a Tick, can you

send the
> > data from the client to the server as a Tick ( this is defined as

long )
?
> > If so you could do this in the client:
> > DateTime.Ticks
> >
> > and in the server:
> > new DateTime( tickCount )
> >
> > in this way you don't care how the datetime is represented on the

client
> or
> > on the server.
> >
> > Hope this help,
> >
> > --
> > Ignacio Machin,
> > ignacio.machin AT dot.state.fl.us
> > Florida Department Of Transportation
> >
> > "Willie wjb" <wj****@nomail.nl> wrote in message
> > news:uY**************@TK2MSFTNGP11.phx.gbl...
> > > Hi,
> > >
> > > i have a client program that sends a filter expression to the server PC.
> > On
> > > that server PC this filter is put over a datatable and the
result is > send
> > > back.
> > >
> > > the server can be located on a PC with let's say ddmmyyyy

windows date
> > > format and the client has mmddyyyy.
> > >
> > > when the filter expression send is "Date < #31/01/2003#", it
will fail
> on
> > > the server because the format for day and month is different.
> > >
> > > is there a generic way to send a filter expression used with the
> > > DataTable.Select command so that it works always whatever the

windows
> > > setting is?
> > >
> > > or should i get the default windows date format from the server,

send
it
> > to
> > > the client which it should use?
> > >
> > > thanks.
> > >
> > >
> >
> >
>
>



Nov 15 '05 #7

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

Similar topics

0
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the...
4
by: S. van Beek | last post by:
Dear reader, By a Date field with Now() as default value the content of the field is date plus time. As I need a filter in a query on date only (excluding time) I invented the following...
6
by: ronchese | last post by:
Hi. I'm trying to make a criteria string to use in Select() method of a datatable, searching for a date, but it is apparently not working! In one of my tests, I have a datatable with 1 row and...
6
by: fonzie | last post by:
Is there any way to include two unbound text boxes (for a start date and end date) to a filter-by-form? The users may want to filter by several different fields and they may want to include a date...
5
by: Ron S | last post by:
After days of searching I finally an example that would work with my application, the only problem is after entering all of the code it is not working. Would someone be kind enough to take a look at...
2
by: jcf378 | last post by:
hi all. I have a form which contains a calculated control ("days") that outputs the # of days between two dates (DateDiff command between the fields and ). However, when I click "Filter by...
9
by: dee | last post by:
I'd like to filter by the following criteria: left(LeadDisposition,3) = "Sit" AND Appt_Date = Text767 I have no idea how to do this. Appreciate help.
0
by: Ripendra007 | last post by:
hi all, i want to filter the date which is in label1.text like dview.RowFilter = "dir_bdate = '"+label1.Text+" '" ; here dir_bdate is my DateTime field of database and label1 contains string in...
5
by: DAHMB | last post by:
Hi all, Using Access 2007 I have a report called Sunday School Attendance based on a Query called qryAttendance the query is as follows: SELECT tblSundaySchoolAttendance.StudentID,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...

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.