0
votes

I had this application done for mySQL, but now I have to remake it for oracle. So now I am running into this

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, TaskCompletionSource1 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, TaskCompletionSource1 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

There are the areas of code which are realted to this.

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

The function

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;         
        }

And the conString

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

I was trying to find the solution but unsuccesfuly. I will be greatefull for any help. Thanks.

1
This seems to be wrong: DATA SOURCE=epcepc091:1521/XE should you put the port number as the last part epcepc091/XE:1521 - Steve
Well, thats not it :/ - Tomáš Filip
The exception points to an SqlConnection failing but this should not be the case with a ProviderName set to Oracle libraries. It is like the ProviderName is wrong. Can you try to set the ProviderName property directly in code and not implicitly via the ConnectionString? - Steve
Hey man thank you! - Tomáš Filip

1 Answers

1
votes

So thanks to Seve, thanks you really all I had to do was add

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

Dont know why it wasnt working within Web.config. Thank you Steve.