这个同样的问题已经在这里问:Getting Exception 'Cannot convert '08/10/09' to a timestamp' while connecting to Sybase Database with .NetSQL Anywhere错误-157:无法转换'08/10/09' 的时间戳
没有回答已经提供了,我无法发表评论,该线程作为我是一个新用户,所以我试图再次问。
我试图建立一个.NET应用程序来谈论到Sybase/ASE/SQL Anywhere数据库,使用SAP在这里找到的信息:http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.sdk_12.5.1.adonet/html/adonet/Connecting_adodotnet_development.htm
随着所有的说,这里是我使用的代码:
private void MainWindow_Load(object sender, EventArgs e) {
using (AseConnection con = new AseConnection("Provider=ASEOLEDB.1; Data Source=localhost; Port=2638; Database={correct db name}; Uid={correct username}; Pwd={correct password}; Charset=iso_1;")) {
con.Open();
}
}
我得到扔在con.Open()异常:
“SQL Anywhere错误-157:无法转换'08/10/09' 的时间戳”
堆栈跟踪如下:
at Sybase.Data.AseClient1.AseConnection.Open()
at Sybase.Data.AseClient.AseConnection.Open()
at ReportGenerator.MainWindow.MainWindow_Load(Object sender, EventArgs e)
in C:\Projects\DiCello\ReportGenerator\ReportGenerator\MainWindow.cs:line 21
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
我已经看到了以下内容:https://archive.sap.com/discussions/thread/3646147,然而这并不适用,因为我不是试图运行一个查询,我还不能建立到运行建议的查询的连接。 2009年10月8日的日期不是我提交到任何地方的日期。还要注意,这个异常是在AseConnection.Open()上的,我没有提交格式错误的日期,格式错误的日期也不存在于数据库中。
所以我想通了,但不能发布的答案:(请投了我的问题,所以我可以张贴的答案。 –