Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何从Sybase SQL Anywhere 11检索数据?_C#_Sqlanywhere - Fatal编程技术网

C# 如何从Sybase SQL Anywhere 11检索数据?

C# 如何从Sybase SQL Anywhere 11检索数据?,c#,sqlanywhere,C#,Sqlanywhere,因此,我无法检索数据,但我已连接。 我还尝试使用“服务器资源管理器”进行连接,它可以正确地连接和检索数据,而不会出现任何问题 “服务器资源管理器”上的设置 Platform: visual Studio 2010 Language: C# Framework: .NET 4.0 Project: Windows Form 现在,在我的源代码中,我使用System.Data.Odbc Connection String: Driver={SQL Anywhere 11};userid=*****

因此,我无法检索数据,但我已连接。 我还尝试使用“服务器资源管理器”进行连接,它可以正确地连接和检索数据,而不会出现任何问题

“服务器资源管理器”上的设置

Platform: visual Studio 2010
Language: C#
Framework: .NET 4.0
Project: Windows Form
现在,在我的源代码中,我使用System.Data.Odbc

Connection String: Driver={SQL Anywhere 11};userid=*****;servername=*****;autostop=YES;integrated=NO;filedsn=C:\*****\*****.db.dsn;commlinks='SharedMemory,TCPIP{host=}';compress=NO

Provider: `.NET Framework Data Provider for ODBC`
错误:
未找到错误[42S02][Sybase][ODBC驱动程序][SQL Anywhere]表“代理”

我也尝试过使用OleDb和iAnywhere.Data.SQLAnywhere(V2),但运气不好,我无法通过这一个错误

有人经历过同样的问题吗


感谢您提供任何意见。

此查询在默认数据库(如Master)上运行 将数据库名称添加到ConnString或CommandString中,如下所示:

Code:

String connString = @"Driver={SQL Anywhere 11};userid=*****;servername=gamca;autostop=YES;integrated=NO;filedsn=C:\*****\*****.db.dsn;debug=NO;disablemultirowfetch=NO;commlinks='SharedMemory,TCPIP{host=}';compress=NO;password=*****";
OdbcConnection myConnection = new OdbcConnection(connString);
commandString = "DELETE from AGENCY";
try {
   using (OdbcCommand cmd = new OdbcCommand(commandString, myConnection)) {
   myConnection.Open();
   cmd.ExecuteNonQuery();
   myConnection.Close();
}
别忘了用您的数据库名替换MyDatabase。

我在我的字符串中添加了“dsn=MyDatabase”,但仍然发生了相同的错误。我还尝试将“USE MyDatabase DELETE from AGENCY”写入我的commandString,它产生了一个新的错误,即“DELETE line 1附近的语法错误”
commandString = "USE MyDatabase DELETE from AGENCY";