【问题标题】:Exception Details: System.ArgumentException: Keyword not supported: 'unicode'异常详细信息:System.ArgumentException:不支持关键字:'unicode'
【发布时间】:2014-03-11 05:56:10
【问题描述】:

您好,我正在使用 3 层架构在 vb.net 中创建应用程序。

我的数据库连接是:

Implements IDisposable
    Public Shared ReadOnly mcpConnectionString As String = System.Configuration.ConfigurationManager.ConnectionStrings("con1").ConnectionString
    Private _McpConnection As OracleConnection

业务层是:

Public Class blayer
    Inherits DBConnection
    Public Sub ses_test_insert(ByVal p_userid As Integer, ByVal p_username As String, ByVal p_createdby As String, ByVal p_date As String)
        SqlHelper.ExecuteNonQuery(mcpConnectionString, "insertDBUSER", p_userid, p_username, p_createdby, p_date)
    End Sub

在网络配置中:

<add name="con1" connectionString="Data Source=xe;User ID=system;Password=sesu;Unicode=True" providerName="System.Data.OracleClient" />

我使用 Oracle 作为后端工具。我在oracle insertDBUSER中创建了Procedure ....

我无法将数据插入表中。当我单击插入按钮时,它会显示

Exception Details: System.ArgumentException: Keyword not supported: 'unicode'.

Source Error: 


Line 12:     Inherits DBConnection
Line 13:     Public Sub ses_test_insert(ByVal p_userid As Integer, ByVal p_username As String, ByVal p_createdby As String, ByVal p_date As String)
Line 14:         SqlHelper.ExecuteNonQuery(mcpConnectionString, "insertDBUSER", p_userid, p_username, p_createdby, p_date)
Line 15:     End Sub
Line 16: End Class

有什么问题吗?

删除 unicode 后显示:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

【问题讨论】:

    标签: asp.net vb.net c#-4.0 visual-studio-2008 unicode


    【解决方案1】:

    旧帖子,但我今天遇到了同样的问题。 Oracle 确实支持“Unicode=True”。如果您尝试使用 SQL 服务器连接 System.Data.SqlClient.SqlConnection 连接到 Oracle,则会收到此错误和以下错误。请改用 System.Data.OracleClient.OracleConnection(或其他一些 ADO.Net Oracle 提供程序)。

    【讨论】:

      【解决方案2】:

      在你的连接字符串中它说:

      Unicode=True
      

      显然Oracle不支持,你应该删除它。

      【讨论】:

      • 删除 Unicode 后,它显示建立与 SQL Server 的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确以及 SQL Server 是否配置为允许远程连接。 (提供者:命名管道提供者,错误:40 - 无法打开与 SQL Server 的连接)
      猜你喜欢
      • 1970-01-01
      • 2011-04-07
      • 1970-01-01
      • 2011-03-20
      • 2019-03-21
      • 2013-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多