2017-05-26 2 views
0

Ich hatte diese Anwendung für mySQL gemacht, aber jetzt muss ich es für Oracle neu erstellen. So, jetzt bin ich laufen in diesemDer Netzwerkpfad wurde nicht gefunden C# und Oracle

Server Error in '/' Application.

The network path was not found

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ComponentModel.Win32Exception: The network path was not found

Source Error:

Line 222: //By department result. Line 223:
GridDatasource1(); Line 224: GridView1.DataBind(); Line 225: //End of by department result. Line 226:
//Multiple surname results.

Source File: C:\Users\tomas.filip\Documents\Visual Studio 2015\Projects\WebApplication1\WebApplication1\Default.aspx.cs Line: 224

Stack Trace:

[Win32Exception (0x80004005): The network path was not found]

[SqlException (0x80131904): 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)]
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling) +1418
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +470
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +70
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +945
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +114
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1637
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource 1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +117
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +267
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource 1 retry, DbConnectionOptions userOptions) +318
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource
1 retry) +132
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +246 System.Data.SqlClient.SqlConnection.Open() +122
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +177
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +182
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +123
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +2964
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +26
WebApplication1._Default.Button1_Click(Object sender, EventArgs e) in C:\Users\tomas.filip\Documents\Visual Studio 2015\Projects\WebApplication1\WebApplication1\Default.aspx.cs:224
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +11828965
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1735

Es gibt die Bereiche der Code, der diese realted werden.

//By department result. 
GridDatasource1(); 
GridView1.DataBind(); 
//End of by department result. 

Die Funktion

protected void GridDatasource1() 
     { 
      SqlDataSource SqlDataSource2 = new SqlDataSource(); 
      SqlDataSource2.ID = "SqlDataSource2"; 
      this.Page.Controls.Add(SqlDataSource2); 
      SqlDataSource2.ConnectionString = ConfigurationManager.ConnectionStrings["conString"].ConnectionString; 
      SqlDataSource2.SelectCommand = "SELECT * FROM v_employees_intr where PLACE like '" + DropDownList1.SelectedValue + "' ORDER BY '" + RadioButtonList1.SelectedValue + "' ASC;"; 
      GridView1.DataSource = SqlDataSource2;   
     } 

Und die conString

<add name="conString" connectionString="DATA SOURCE=epcepc091:1521/XE;PERSIST SECURITY INFO=True;USER ID=SYSTEM;Password=Epce12345" providerName="System.Data.OracleClient" /> 

ich die Lösung zu finden versuchte, aber unsuccesfuly. Ich werde für jede Hilfe dankbar sein. Vielen Dank.

+0

scheint falsch zu sein: _DATA SOURCE = epcepc091: 1521/XE_ sollten Sie setzen die Portnummer als letzter Teil _epcepc091/XE: 1521_ – Steve

+0

Nun, das ist es nicht:/ –

+0

Die Ausnahme verweist auf eine SqlConnection versagt, aber das sollte nicht der Fall sein, wenn ein ProviderName auf Oracle-Bibliotheken eingestellt ist. Es ist wie der ProviderName falsch ist. Können Sie versuchen, die ProviderName-Eigenschaft direkt im Code und nicht implizit über den ConnectionString festzulegen? – Steve

Antwort

1

So dank Seve dank Sie wirklich alles, was ich tun musste, war hinzufügen

SqlDataSource2.ProviderName = "System.Data.OracleClient"; 

weiß nicht, warum es innerhalb Web.config Arbeit war nicht. Danke, Steve. Diese

Verwandte Themen