title: ErrorSystem.Data.OleDb.OleDbException (0x80004005): ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
body: <p>I am working on a c# project to register a new user in visual studio and using toad for database.The code to conect to database is:</p>
  
  <pre><code>protected void New_User(object sender, EventArgs e)
      {
      OleDbConnection conn;
  
  
       OleDbDataAdapter OledbAdapter = new OleDbDataAdapter();
              String sql = "";
              conn = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString);
  
              sql = "INSERT INTO USER_DETAIL VALUES('" + TextBoxUN.Text + "','" +TextBoxPass.Text+ "', '" + TextBoxEmail.Text + "','" + TextBoxmobileno.Text +"')";
              try
              {
                  conn.Open();
                  OledbAdapter.InsertCommand = new OleDbCommand(sql, conn);
                  OledbAdapter.InsertCommand.ExecuteNonQuery();
                  Label_success.Text = "Successfully inserted into database";
              }
              catch (Exception ex)
              {
                  Label_success.Text = "Error" + ex.ToString();
              }
              finally
              {
                  conn.Close();
              }
  }
  </code></pre>
  
  <p>and my web.config file is:</p>
  
  <pre><code> &lt;?xml version="1.0"?&gt;
  
      &lt;!--
        For more information on how to configure your ASP.NET application, please visit
        http://go.microsoft.com/fwlink/?LinkId=169433
        --&gt;
  
      &lt;configuration&gt;
        &lt;connectionStrings&gt;
          &lt;add name="ConnString" connectionString="Provider=MSDAORA;Data Source=TRGDB;Persist Security Info=True;Password=pass;User ID=TRAINEE01" providerName="System.Data.OleDb"/&gt;
          &lt;add name="ApplicationServices"
               connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
               providerName="System.Data.SqlClient" /&gt;
        &lt;/connectionStrings&gt;
  
        &lt;system.web&gt;
          &lt;compilation debug="true" targetFramework="4.0" /&gt;
  
          &lt;authentication mode="Forms"&gt;
            &lt;forms loginUrl="~/Account/Login.aspx" timeout="2880" /&gt;
          &lt;/authentication&gt;
  
          &lt;membership&gt;
            &lt;providers&gt;
              &lt;clear/&gt;
              &lt;add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
                   enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
                   maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
                   applicationName="/" /&gt;
            &lt;/providers&gt;
          &lt;/membership&gt;
  
          &lt;profile&gt;
            &lt;providers&gt;
              &lt;clear/&gt;
              &lt;add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/&gt;
            &lt;/providers&gt;
          &lt;/profile&gt;
  
          &lt;roleManager enabled="false"&gt;
            &lt;providers&gt;
              &lt;clear/&gt;
              &lt;add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" /&gt;
              &lt;add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" /&gt;
            &lt;/providers&gt;
          &lt;/roleManager&gt;
  
        &lt;/system.web&gt;
  
        &lt;system.webServer&gt;
           &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
        &lt;/system.webServer&gt;
      &lt;/configuration&gt;
  </code></pre>
  
  <p>But i am getting the following error:</p>
  
  <blockquote>
    <p>ErrorSystem.Data.OleDb.OleDbException (0x80004005): ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.OleDb.OleDbConnection.Open() at Project._Default.New_User(Object sender, EventArgs e) in c:\documents and settings\admin\my documents\visual studio 2010\Projects\Project\Project\Default.aspx.cs:line 26</p>
  </blockquote>