ODBC 普遍错误

发布于 2024-11-10 17:12:49 字数 951 浏览 4 评论 0原文

对于我正在开发的这个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

温折酒 2024-11-17 17:12:49

行 :

OdbcCommand command = new OdbcCommand(myConnectionString, myConnection);

中应包含您的 SQL 语句:

OdbcCommand command = new OdbcCommand("select * from table", myConnection);

而不是连接字符串。当您调用 ExecuteReader 行时,SQL 引擎会尝试执行不是有效 SQL 语句的连接字符串。

The line :

OdbcCommand command = new OdbcCommand(myConnectionString, myConnection);

should have your SQL statement in it:

OdbcCommand command = new OdbcCommand("select * from table", myConnection);

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.

树深时见影 2024-11-17 17:12:49

我将始终使用 Pervasive ADO.NET 数据提供程序。它应该与数据库引擎一起安装,但如果没有安装,您可以在此处下载:http ://www.pervasivedb.com/psqlv11/pages/default.aspx

他们的网站上也提供了很多示例。

另外,尝试将连接字符串更改为基本形式并使用 DSN:

ServerDSN=DSNData;UID=username;PWD=password;Server=SERVERNAME

此设置没有遇到任何问题。

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:

ServerDSN=DSNData;UID=username;PWD=password;Server=SERVERNAME

I haven't had any problems with this setup.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文