调用AseDataReader的ExecuteReader时发生AccessViolationException

时间:2014-02-04 17:10:02

标签: ado.net sybase-ase

我收到此错误

  

System.AccessViolationException未处理     的HResult = -2147467261     Message =尝试读取或写入受保护的内存。这通常表明其他内存已损坏。     来源= Sybase.AdoNet4.AseClient     堆栈跟踪:          在Sybase.Data.AseClient.Unmanaged.ModifyCommandTextForSchemaOnly(String commandText,StringBuilder modifiedCommandText,Int32 capacity)          在Sybase.Data.AseClient1.AseCommand.ModifyCommandTextForSchemaOnly(String commandText)          在Sybase.Data.AseClient1.AseCommand.GetCommandText(CommandBehavior commandBehavior)          在Sybase.Data.AseClient1.AseCommand.SetCommandStatement(CommandBehavior commandBehavior)          在Sybase.Data.AseClient1.AseCommand.Execute(CommandBehavior commandBehavior)          在Sybase.Data.AseClient1.AseCommand._ExecuteReader(CommandBehavior commandBehavior)          在Sybase.Data.AseClient1.AseCommand.ExecuteReader(CommandBehavior commandBehavior)          在Sybase.Data.AseClient.AseCommand.ExecuteReader(CommandBehavior commandBehavior)

致电

Dim cm As AseCommand = New AseCommand("SELECT * FROM Results;", cn)
Dim rd As AseDataReader = cm.ExecuteReader(CommandBehavior.SchemaOnly)

其中cn是AseConnection。

我使用的是Sybase.AdoNet4.AseClient.dll

版本4.157.1000.0

1 个答案:

答案 0 :(得分:0)

问题是SQL文本中的分号,删除它,一切都很好。

Dim cm As AseCommand = New AseCommand("SELECT * FROM Results", cn)