• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
wysky
博客园    首页    新随笔    联系   管理    订阅  订阅
[笔记]读取含日期格式的记录SQLite报错"该字符串未被识别为有效的 DateTime"的问题
发现Firefox的SQLite Manager插件的时间问题,手工添加的数据,程序读取的时候报无效的DateTime格式,如果用程序添加,则没有此问题. SQLite Manager 版本0.3.1

发现Firefox的SQLite Manager插件的时间问题,手工添加的数据,程序读取的时候报无效的DateTime格式,如果用程序添加,则没有此问题.

SQLite Manager 版本0.3.17

System.Data.SQLite.dll版本:1.0.60.0

该字符串未被识别为有效的 DateTime。

说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.FormatException: 该字符串未被识别为有效的 DateTime。
源错误:

行 24:             info.Nickname = reader["nickname"].ToString();
行 25:             info.Realname = reader["realname"].ToString();
行 26:             info.Bdday = Convert.ToDateTime(reader["bdday"]).ToString("yyyy-MM-dd");
行 27:             info.Regip = reader["regip"].ToString();
行 28:             info.Regdate = Convert.ToDateTime(reader["regdate"]).ToString("yyyy-MM-dd");
 
 
 

堆栈跟踪:

[FormatException: 该字符串未被识别为有效的 DateTime。]
   System.DateTimeParse.ParseExactMultiple(String s, String[] formats, DateTimeFormatInfo dtfi, DateTimeStyles style) +2827362
   System.DateTime.ParseExact(String s, String[] formats, IFormatProvider provider, DateTimeStyles style) +49
   System.Data.SQLite.SQLiteConvert.ToDateTime(String dateText) +260
   System.Data.SQLite.SQLiteConvert.ToDateTime(IntPtr ptr, Int32 len) +65
   System.Data.SQLite.SQLite3.GetDateTime(SQLiteStatement stmt, Int32 index) +88
   System.Data.SQLite.SQLite3.GetValue(SQLiteStatement stmt, Int32 index, SQLiteType typ) +528
   System.Data.SQLite.SQLiteDataReader.GetValue(Int32 i) +178
   System.Data.SQLite.SQLiteDataReader.get_Item(String name) +62
   iTCA.Yuwen.Core.Users.DataReader2UserInfo(IDataReader reader) in F:\Doctments\Works\Mine\iTCAWeb\trunk\iTCA.Yuwen.Core\Users.cs:26
   iTCA.Yuwen.Core.Users.GetUserInfo(String loginid, String password, Int32 logintpye) in F:\Doctments\Works\Mine\iTCAWeb\trunk\iTCA.Yuwen.Core\Users.cs:50
   iTCA.Yuwen.Web.login.Page_Show() in F:\Doctments\Works\Mine\iTCAWeb\trunk\iTCA.Yuwen.Web\login.aspx.cs:17
   iTCA.Yuwen.Web.BasePage..ctor() in F:\Doctments\Works\Mine\iTCAWeb\trunk\iTCA.Yuwen.Web\BasePage.cs:45
   iTCA.Yuwen.Web.login..ctor() +43
   ASP.login_aspx..ctor() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\955e2214\b4bcb2de\App_Web_vg4npwke.2.cs:0
   __ASP.FastObjectFactory_app_web_vg4npwke.Create_ASP_login_aspx() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\955e2214\b4bcb2de\App_Web_vg4npwke.5.cs:0
   System.Web.Compilation.BuildResultCompiledType.CreateInstance() +32
   System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +119
   System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
   System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
   System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +160
   System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
posted on 2008-12-08 15:26  文's sky  阅读(4241)  评论(5)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3