ODBC 普遍错误
对于我正在开发的这个 ASP.NET 应用程序,连接到这个普遍的服务器是最困难的。现在,我可以使用 Visual Studio 中的服务器资源管理器中的连接字符串访问和查看整个数据库,但是当我实际运行它时,我收到错误。这是我的代码:
String myConnectionString =
"Driver={Pervasive ODBC Client Interface};servername=192.168.1.2;dbq=@Live;";
OdbcConnection myConnection = new OdbcConnection(myConnectionString);
OdbcCommand command = new OdbcCommand(myConnectionString, myConnection);
try
{
myConnection.Open();
OdbcDataReader reader = command.ExecuteReader();
reader.Close();
command.Dispose();
myConnection.Close();
}
catch (OdbcException ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message);
}
这是运行时出现的错误:
ERROR [42000] [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface]Syntax Error: Driver<< ??? >>={Pervasive ODBC Client Interface}
任何帮助将不胜感激,即使这只是一个疯狂的猜测,因为我现在有点绝望。
谢谢
I am having the hardest time connecting to this pervasive server for this asp.net application I'm working on. Right now, I am able to access and view the entire database using my connection string in the server explorer in visual studio however when I actually run it I get an error. Here is my code:
String myConnectionString =
"Driver={Pervasive ODBC Client Interface};servername=192.168.1.2;dbq=@Live;";
OdbcConnection myConnection = new OdbcConnection(myConnectionString);
OdbcCommand command = new OdbcCommand(myConnectionString, myConnection);
try
{
myConnection.Open();
OdbcDataReader reader = command.ExecuteReader();
reader.Close();
command.Dispose();
myConnection.Close();
}
catch (OdbcException ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message);
}
Here is the error I get when it runs:
ERROR [42000] [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface]Syntax Error: Driver<< ??? >>={Pervasive ODBC Client Interface}
Any help would be greatly appreciated, even if it is only a wild guess as I'm kind of desperate right now.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
行 :
中应包含您的 SQL 语句:
而不是连接字符串。当您调用 ExecuteReader 行时,SQL 引擎会尝试执行不是有效 SQL 语句的连接字符串。
The line :
should have your SQL statement in it:
rather than the connection string. When you call the ExecuteReader line, the SQL engine tries to execute the connection string which is not a valid SQL statement.
我将始终使用 Pervasive ADO.NET 数据提供程序。它应该与数据库引擎一起安装,但如果没有安装,您可以在此处下载:http ://www.pervasivedb.com/psqlv11/pages/default.aspx
他们的网站上也提供了很多示例。
另外,尝试将连接字符串更改为基本形式并使用 DSN:
此设置没有遇到任何问题。
I would always use the Pervasive ADO.NET Data Provider. It should be installed with the database engine, but if it is not you can download it here: http://www.pervasivedb.com/psqlv11/pages/default.aspx
Lots of examples are available as well on their website.
Also, try changing the connection string to be in the basic form and use a DSN:
I haven't had any problems with this setup.