Connection to Sybase server has been lost. All active transactions have been rolled back

wind7788 2007-03-28 02:39:08
我用C#2.0+Sybase 15.0进行web开发,最近这段时间经常出现这种错误:请问如何解决。急-------------------

“/WEB”应用程序中的服务器错误。
--------------------------------------------------------------------------------

Connection to Sybase server has been lost. All active transactions have been rolled back
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: Sybase.Data.AseClient.AseException: Connection to Sybase server has been lost. All active transactions have been rolled back

源错误:


行 43: try
行 44: {
行 45: cmd.Connection.Open();
行 46: AseDataReader reader=cmd.ExecuteReader();
行 47: if(reader.Read())


源文件: E:\V8\SourceCode\V8\DAL\SmallGranularity\SysParam.cs 行: 45

堆栈跟踪:


[AseException: Connection to Sybase server has been lost. All active transactions have been rolled back]
Sybase.Data.AseClient.AseConnectionPool.?(AseConnection A_0) +449
Sybase.Data.AseClient.AseConnection.Open() +342
V8.DAL.SysParam.Retrieve(Int64 id) in E:\V8\SourceCode\V8\DAL\SmallGranularity\SysParam.cs:45

[Exception: Connection to Sybase server has been lost. All active transactions have been rolled back]
V8.DAL.SysParam.Retrieve(Int64 id) in E:\V8\SourceCode\V8\DAL\SmallGranularity\SysParam.cs:63
V8.BLL.SysParam.Retrieve(SysParameters para) in E:\V8\SourceCode\V8\BLL\ExtendLibreary\SysParam.cs:30
Main_Default.Page_Load(Object sender, EventArgs e) in e:\V8\SourceCode\V8\WEB\Main\Default.aspx.cs:22
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061




--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.42; ASP.NET 版本:2.0.50727.210
...全文
1448 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
beidou566 2010-06-13
  • 打赏
  • 举报
回复
取参数值的时候要求数据库连接保持Open状态
AseConnection con = new AseConnection("Data Source='SYBASE'; Port=5000; UID='sa'; PWD=''; Database='data';Connection Timeout='300';") ; 
AseCommand com = new AseCommand("GetDataRightSQL", con) ;
com.CommandType = System.Data.CommandType.StoredProcedure ;
try
{
AseParameter prm = new AseParameter("@UserID", 1) ;
// prm.Direction = System.Data.ParameterDirection.Input ;
com.Parameters.Add(prm) ;
prm = new AseParameter("@Category","Department") ;
com.Parameters.Add(prm) ;
com.Parameters.Add(new AseParameter("@FieldName", "Dept_ID")) ;
prm = new AseParameter("@returnSql", AseDbType.VarChar, 250) ;
prm.Direction = System.Data.ParameterDirection.Output ;
com.Parameters.Add(prm) ;
con.Open() ;
com.ExecuteNonQuery() ;
con.Close() ; //提前关闭数据库
Console.WriteLine(com.Parameters["@returnSql"].Value) ;

}
finally
{
if( con != null && con.State == System.Data.ConnectionState.Open )
con.Close() ;
}
return ;
iihero 2010-06-12
  • 打赏
  • 举报
回复
[Quote=引用楼主 wind7788 的回复:]
我用C#2.0+Sybase 15.0进行web开发,最近这段时间经常出现这种错误:请问如何解决。急-------------------

“/WEB”应用程序中的服务器错误。
--------------------------------------------------------------------------------

Connection to Syb……
[/Quote]
判断相应异常,重新open一下试试。
leon_wwj_66 2010-06-12
  • 打赏
  • 举报
回复
我也遇到这个问题了。但是我的数据库表中有一条记录。
而且,另台pc上运行同样的代码都没问题!!!!!

我晕啊!!!!!


到底是什么原因???????
-孤狼- 2008-05-07
  • 打赏
  • 举报
回复
我在想是不是可能是连接超时,可是AseConnection.ConnectionTimeout不设置,好像是只读?不是属性吗?着么不能设置....
-孤狼- 2008-05-07
  • 打赏
  • 举报
回复
还有请教为什么AseConnection.ConnectionTimeout不能设置呢?
-孤狼- 2008-05-07
  • 打赏
  • 举报
回复
我也出现同样的问题呀,请教是什么原因?有没有什么方法解决呀?
sun888rui 2007-06-19
  • 打赏
  • 举报
回复
把连接SYBASE数据库的时候改大一点就好了。

2,596

社区成员

发帖
与我相关
我的任务
社区描述
Sybase相关技术讨论区
社区管理员
  • Sybase社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧