codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  how connect oracle with asp.net  mfa786 at 06:29 on Thursday, November 30, 2006
 

hi master
sir i have oracle database how i connect my oracle with asp.net
and i not want new connection code in every page my need is
i deffine connection code one time in first page and use in all page

such as vb6

please give me idea

thanks

aamir

  Re: how connect oracle with asp.net  amitvps at 06:53 on Thursday, November 30, 2006
 

Hi aamir,
You need to define you connection string in Web.Config file.

-Amit

  Re: how connect oracle with asp.net  ymdomar at 08:58 on Friday, December 15, 2006
 

Yes, u can achieve this using web.config file.. The following code would be helpful to understand...

In web.cofig
============
You can define key pair value and use it in your application. Its available in entire application.

// Adding key = ConnectionString contains database connection
<configuration>
<appSettings>
<add key="ConnectionString" value="Data Source=intranet-xp;Initial Catalog=xysz;User Id=myself;Password=joke;" />
</appSettings>
<configuration>

In aspx.cs page
===============
1. using System.Configuration; namespace to fetch config file values.
2. Use ConfigurationSettings.AppSettings.AppSettings[key]; to fetch particular key value.

To fetch the above connection string...

OracleConnection MyConnection = new OracleConnection(ConfigurationSettings.AppSettings["ConnectionString"]);









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Write text strings to Serial Port
•  Calcluate Date Difference [Seriouslt a new challenge]
•  source code to generate perl library
•  Plz Help Me Out...!!! I want to add a crystal report to my application
•  Floating div
•  Re: open excel file in html page
•  Such A Newbie - Mailing Label Program
•  Classified Script
•  Re: saving??


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007