问题日日/月扭转上保存 [英] Problem with date day/month reversing on save

查看:264
本文介绍了问题日日/月扭转上保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个问题只影响生产环境。

我们必须手编辑的VB6 / ASP网站,允许数据在数据库表中。

它看起来像很多可编辑的DataGrid。

一个可编辑的列是一个日期和保存记录日期日/月正在逆转。

2008年3月11日变成11/03/2008,如果你要重新保存记录的日期又是2008年3月11日。

我已经检查了DB值,这的确被逆转然而同样的相同$ C $的测试系统C没有做到这一点。

所以我非常有信心,我正在寻找一个环境的变化。该测试系统具有DB和站点本地托管,并在现场设置,我们有一个单独的网站服务器和数据库服务器。你在哪里建议我开始寻找这个问题。我检查了服务器上的区域设置,它们被设置为英国和OS的日期格式是正确的。

这是SQL Server 2000的打了我的一些想法!

感谢:)


解决方案

如果您的用户提供的字符串转换成日期的的你将它输入到数据库,那么的 Session.LCID线程执行ASP页的是负责如何日期间preTED 。

如果你喂的日期作为字符串到SQL Server,让转换发生在那里,这将是窥视的 SET DATEFORMAT 和的 设置语言 声明。

因此​​,这里是我的想法:要么停止使用(鼓励用户使用)明确的日期格式,而这个问题会消失,或者确保加工链的各个环节有什么期望格式清晰的认识

We have a problem affecting the production environment only.

We have a VB6/ASP website that allows for data in a database table to be hand edited.

It looks alot like an editable datagrid.

One of the editable columns is a date and when the record is saved dates day/month are being reversed.

03/11/2008 becomes 11/03/2008, if you were to resave the record the date is again 03/11/2008.

I have checked the DB value and it is indeed being reversed however the same identical code on the test systems does not do this.

So i'm very confident i'm looking for an environment change. The test system has the DB and Site hosted locally and in the live setup we have a separate web site server and database server. Where do you suggest I start looking for this problem. I've checked the regional settings on the servers and they are set to United Kingdom and the OS date format is correct.

This is SQL Server 2000. hit me with some ideas!.

Thanks :)

解决方案

If you convert the user supplied string to a date before you feed it to the DB, then the Session.LCID of the thread executing your ASP page is responsible for how dates are interpreted.

If you feed the date as a string to SQL Server and let the conversion happen there, it will be useful to look into the SET DATEFORMAT and the SET LANGUAGE statements.

So here is my idea: Either stop using (encouraging your users to use) ambiguous date formats, and this problem will disappear, or make sure all links of the processing chain have a clear understanding on what format to expect.

这篇关于问题日日/月扭转上保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆