Oracle Connection Issue with Gridview

TrioxX

New Member
I try to connect a oracle database in asp.net. I want to handle connection with SqlDataSource. When I use the code below, I get the following error: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 system can not find the file specified.Source Error:[Win32Exception (0x80004005): The system can not find the file specified.][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)]Here is the aspx file:\[code\]<%@ Page Language="C#" AutoEventWireup="true" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org /TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"><title></title></head><body><form id="form1" runat="server"><div> <asp:SqlDataSource id="SqlDataSource1" runat="server" DataSourceMode="DataReader" SelectCommand="SELECT * FROM PERSON " ConnectionString="<%$ ConnectionStrings:OracleConnectionString %>"> </asp:SqlDataSource> <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" BackColor="WindowFrame" AllowSorting="true" AllowPaging="true"> <Columns> <asp:BoundField HeaderText="Numaras?" DataField="ID" /> <asp:BoundField HeaderText="Ad?" DataField="NAME" /> <asp:BoundField HeaderText="Soyad?" DataField="SURNAME" /> </Columns> </asp:GridView> <br /></div> </form>\[/code\]But I can connect database directly, besides I can connect it with another code file , with the procedure below: private void ReadOracleTypesExample(string connectionString) { OracleConnection connection = new OracleConnection(connectionString); connection.Open(); OracleCommand command = connection.CreateCommand(); try { command.CommandText = "SELECT * FROM PERSON"; OracleDataReader reader = command.ExecuteReader();\[code\] if (reader.HasRows) { while (reader.Read()) { OracleString oraclesring2 = reader.GetOracleString(1); Label2.Text += ("<br />" + oraclesring2.ToString()); OracleString oraclestring3 = reader.GetOracleString(2); Label3.Text += ("<br /> " + oraclestring3.ToString()); } } else { Console.WriteLine("No rows found."); } reader.Close(); } catch (Exception e) { Label1.Text = e.Message; } finally { connection.Close(); }}\[/code\]The oracle database is accessible by the tools outside the c#. I could not imagine why I can not connect to the database, I will run off the rails. Thanks in advance.
 
Back
Top