异常详细信息:System.ArgumentException:不支持关键字:'unicode'

时间:2014-02-12 17:59:20

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

您好我正在使用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

在Web配置中:

<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)

2 个答案:

答案 0 :(得分:0)

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

Unicode=True

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

答案 1 :(得分:0)

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