本文介绍了在桌面应用程序中未将字符串识别为有效的Date TIme错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个与.net Framework 3.5兼容的应用程序,也可以在其他应用程序中运行它的构建。

I have developed an application which is compatible with .net Framework 3.5 to run the build of it in other applications also.

内置应用程序的操作系统是Windows 7 。

The O. S. of built application is Windows 7.

当我在Windows XP中运行构建时,错误:

And when I run the build in Windows XP this error occurs for following code:

dtBillDate.Text = ds.Tables[0].Rows[0]["Dt"].ToString();

此处 dtBillDate 是DateTimePickerControl。

Here dtBillDate is a DateTimePickerControl.

而填充 ds 记录的SQL查询是:

And the SQL query to fill ds records is:

query = "Select M.BillNo,M.PartyName,M.Address,M.City,M.State,M.TaxType,
M.BillType,FORMAT(M.BillDt,'dd-mm-yyyy')as Dt,
M.CST,M.GST,M.TransportName,M.TruckNo,M.Through,M.Tax,M.AddTax,M.Charges from BillMaster M where M.BillNo=" + billNo;

记录存储在Access 2007数据库中。

Records are stored in the Access 2007 database.

我应该进行哪些更改以解决该错误。

What changes I should make to tackle the error.

请帮助。

推荐答案

在win 7中,基本上可以使用英语印度格式,其中日期分隔符为- 。但是在Win XP中,英语印度格式不可用,因此您可能使用英语美国或英国格式作为日期,并使用 /作为日期分隔符。

Basically in win 7 the "English INDIA " format is available, in which the date separator is "-". But in Win XP " English India" Format is not available, so u might be using " English US or UK" format for date which use "/" as a date separator.

要解决您的问题,您要做的就是通过以下方式将Win XP计算机中的日期分隔符格式更改为-:>控制面板>区域和语言选项>单击自定义>打开日期选项卡并将日期分隔符设置为-。
,您的应用程序将正常运行,没有任何错误。现在快乐:D

TO Solve your problem ,all you gotta do is change the date separator format to "-" in your win xp machine by going to > CONTROL PANEL>REGION AND LANGUAGE OPTIONS> Click On "Customize" > OPEN The "DATE" Tab and here set the DATE SEPARATOR to "-".And Your Application Will Work Without any error. Happy Now :D

这篇关于在桌面应用程序中未将字符串识别为有效的Date TIme错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 03:10
查看更多