How to create a connection between oracle database and the webform

 hi, is anyone here possible to teach me how to connect Oracle  database to my webform?

0
x_Vynel
3/28/2008 3:15:22 AM
asp.net.oracle 2269 articles. 0 followers. Follow

5 Replies
700 Views

Similar Articles

[PageSpeed] 20

To connect to an Oracle database using OraOLEDB, the OLE DB connection string must be as follows:

"Provider=OraOLEDB.Oracle;Data Source=R2D2;User ID=foo; Password=bar";
						

Make sure that you have entry for the data source in tnsnames.ora file and TNSListener service is running. For more information on OraOLEDB provider refer to Orcale9i documentation.

And as an example code try this

private bool ValidateUser(string strLogin, string strPwd)
{
bool bRet = false;
OleDbConnection conn = null;
try
{
string connString = "Provider=OraOLEDB.Oracle;Data Source=R2D2;User ID=foo;Password=bar";
conn = new OleDbConnection(connString);
conn.Open();
string strQuery = "select * from siteusers where login='" + strLogin + "'";
OleDbCommand obCmd = new OleDbCommand(strQuery, conn);
OleDbDataReader obReader = obCmd.ExecuteReader();
while (obReader.Read())
{
string strVal = obReader["password"].ToString();
if (string.Compare(strVal, strPwd) == 0)
{
bRet = true;
}
}
}
catch (OleDbException ex)
{
Response.Write(ex.Message);
throw ex;
}
finally
{
if (null != conn)
{
conn.Close();
}
}
return bRet;
}


Karthik Muthuswamy
Programmer Analyst
Chennai
0
karthik_muthuswamy
3/28/2008 4:14:21 AM

wat to type for the namespace.. and wat is try ,  catch , throw , finally use for?? 

0
x_Vynel
3/28/2008 4:20:48 AM

The namespace you have to include is:

using System.Data.OracleClient;

Hope it worked!


Karthik Muthuswamy
Programmer Analyst
Chennai
0
karthik_muthuswamy
3/28/2008 4:36:50 AM

 visit: http://www.connectionstrings.com/?carrier=oracle

u will surely get a solution 


Alok
0
aloksinha83
3/28/2008 4:52:31 AM

 x_Vynel:

[1] Namespace that you need to add is:

System.Data.OracleClient;
System.Data.Common;


[2] Why to use Try/Catch Block:

Place the sections of code that might throw exceptions in a try block and place code that handles exceptions in a catch block. The catch block is a series of statements beginning with the keyword catch, followed by an exception type and an action to be taken.


Note:  Almost any line of code can cause an exception, particularly exceptions that are thrown by the common language runtime itself, such as SqlException,  OutOfMemoryException and StackOverflowException. Most applications do not have to deal with these exceptions, but you should be aware of this possibility when writing libraries to be used by others. For suggestions on when to set code in a try block

for more information on  Best Practices for Handling Exception just Go to:
http://msdn2.microsoft.com/en-us/library/seyhszts(VS.71).aspx  

 

Thanks,

```````````````````

j@y

 

--> Mark as Answer if this help you. 

 


Thanks,
----
j@y

Please remember to click “Mark as Answer” on the post(s) which helps you !
0
Dexter007
3/31/2008 1:23:00 PM
Reply:

Similar Artilces:

How to create a single Oracle Database connection method or function to be used on or by all classes and pages that want to connect to the database?
 How to create a single Oracle Database connection method or function  to be used on or by all classes and pages that want to connect to the database? How can I create one method or function in csharp to be used on all pages or classes when conenction to the database? Please give an example.I have database connections which I am using on each and very page or classes, but I can I put in one page then I just start  calling it?Database connection I am using:   OracleConnection dbconnection;    this.dbconnection = new System.Data.OracleClient.OracleConnec...

Creating Oracle Database Connection
I am getting a create catalog error when I try to create an Oracle connection in Powerbuilder version 10.5. I have create table permissions with the ID that I'm using. What could be causing this error? By default PB will use the SYSTEM userid to create the catalog tables. On the db-profile system tab you can specify the owner of the PBCATxxx tables. -- Terry Dykstra (TeamSybase) http://powerbuilder.codeXchange.sybase.com/ http://www.pb9books.com product enhancement requests: http://my.isug.com/cgi-bin/1/c/submit_enhancement <Stephen Jung> wrote in message news:4...

Oracle Connections with .net webforms
Hi, I'm just starting out converting my C/S app to a net webform. I'm not sure if I need to do something different to connect to my oracle db. Here's the code I use in my C/S app: transaction DBGrantor DBgrantor = Create transaction DBgrantor.Database = sqlca.database dbgrantor.dbms = sqlca.dbms DBGrantor.LogID = "userID" DBGrantor.Logpass = "password" DBgrantor.ServerName = "snpmis" CONNECT USING DBgrantor; When I use the same code for the web server, I get a generic oracle error 12560. I have the oracle client sw installed and work...

Oracle 8i client connected to Oracle 9 database.
I have connected my Powerbuilder 9 application to a Oracle 9i database using Oracle 8i client. My Oracle home is set to 8. My Powerbuilder DB connection is using Oracle 8. Things seem to work. Why? In general, there will be compatibilty between client and server versions here; however, you'd have to check Oracle for their specific supported configurations. If you try to access anything new in Oracle 9 (like new datatypes, etc.), I expect you'll see problems that may be handled gracefully or not so gracefully. On 3 Dec 2004 13:03:31 -0800, Kurt Pager wrote: >I have co...

Oracle Database - .NET
first of all hello and nice to see you all. this is my first post on this forum and it seems pretty useful..okay just got a small question... i have started to implement Compiere (http://www.compiere.org) in a factory 1. Installed Linux 2. Installed Oracle XE 10g what i want to do is to connect on the oracle database from VS .NET 2005 i checked ConnectionStrings.com nothing worked .. anyone got a solution for this?Did any one every connect from ASP .NET or a Windows Application on oracle running on a linux (CENTOS server)?  thankskimoo   Hi,    ...

VB.NET to oracle database connection
Hello,  I've been trying for days to try to connect to oracle database but still no success, I've put the connection in the web.config in the <ConnectionString> place, created the connection on the page itself: Private sqlCon As New OleDbConnection("Provider=msdaora;Data Source=Server1/orcl2;User Id=Train;Password=Train;") but still no success, Now I'm trying to make a local connection throught Tools > Connect to database but still no success. All I get is this: System.Data.OleDb.OleDbException: ORA-12154: TNS:could not resolve service name at Could ...

Error for connecting the oracle database with webform.aspx
Hi all, I'm a new bie for VS.net and try to connect oracle database with webform that was built by Visual studio dot net 2003 This is a full of my error for connection between Oracle and ASP.net with step by step. 1. Start to build a connection with Oracleconnection in newWebForm.aspx 2. After I click new connection (in dropdown list of conection/data/properties windows), it will pop up Data link Properties (Provider Tab) by default at Microsoft OLE db provider for Oracle 3. Then, I click next Button. it shows link Properties (Connection Tab) and I input da...

Problems connecting to Oracle 9i database with Oracle 10g Client and Win XP x64
Hardware/Software:Dell Precision 490 with Intel Xeon 64 bit processor running MS Windows XP Professional x64 Edition Version 2003 Service Pack 1.Visual Studio .NET 2005 Oracle 10g ClientI am trying to run my ASP.NET application from the above mentioned computer that connects to an Oracle 9i database on another machine on the network, but get the following error when using the OLEDB provider for Oracle:Oracle client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3.3 or later client software installation.Provid...

Problem in creating Oracle connection cache using EAServer 5.0,Oracle 10g
This is a multi-part message in MIME format. ---=_forums-2-dub417ced02 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit I am facing problem to create connection cache using Oracle.I am attaching snapshot of EAServer properties which I set. I refered query dt. 21 jul,04 topic "EAServer JDBC connection to Oracle". But it not works. ---=_forums-2-dub417ced02 Content-Type: application/x-zip-compressed; name="Oracle connection cache problem.zip" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=&q...

connection string for Oracle database c# dot net
how to connect the oracle database from the asp.net C# code.. thanks in advance for your guidance.. Hi, take a look at: http://www.connectionstrings.com/?carrier=oracle. Grz, Kris.Read my blog. Handy Firefox plugins for web developers. it was useful. thanks a lot.....

urgent: .NET Provider for Oracle or Oracle Data Provider for .NET
If I want to access Oracle DB in ASP.NET application, and I am using .NET Provider for Oracle or Oracle Data Provider for .NET, should I have to install OracleClient on my .NET server? Is there other choice? Thank you very much.Johnson Johnson2007:should I have to install OracleClient on my .NET server?  You have to options1. install the ODP.NET on your web serverOR2. put the oracle assemblies in your BIN directory   Hi jimmy,Thank you for you reply. Because I could not find a server right now, I should test it first before I agree or disagree with you, as most articles I...

Can't connect to Oracle database using Oracle 10g Client in Windows 2003 Enterprise
Hi, Our test environment is Windows 2003 enterprise with IIS and Oracle 10g client installed. I wrote a simple asp.net program to connect to a Oracle database and display the select result in a datagrid. But can't connect to Oracle. It seems .NET can't find the oracle client. Any idea is highly appreciated. Thanks in advance. Joey...

how to connect Oracle Database in Smart Device Application using .Net Compact Framework
Edited by moderator XIII: Please read this article: How to post on forums Dear all, I am using Smart Device Application using .Net Compact Framework & want to access Oracle database (such as inserting,updating,retrieving data from oracle database). Can anyone provide me any code (in C#) for data access or any link related to this topic? Regsrds Anirban You did not mention where your oracle database resides. One way is to write a web service where you can write all your code related to database access and manipulation. You can call this web service from your sm...

Connecting PB 5.0.03 to Oracle 8 (NT) through SQL Net v2 with driver for Oracle 7.3 of PB
Can anyone assist me on Connecting PB 5.0.03 to Oracle 8 (NT) through SQL Net v2 with driver for Oracle 7.3 of PB ? Thank you very much in advance. -- John Fotiadis Direct +30 94-464225 Senior Systems Engineer Relational Technology S.A. In article <34979B76.67A813A8@sybase.com.gr>, johnf@sybase.com.gr says... > Can anyone assist me on Connecting PB 5.0.03 to Oracle 8 (NT) through > SQL Net v2 with driver for Oracle 7.3 of PB ? > > Thank you very much in advance. > > -- > John Fotiadis > Direct +30 94-464225 > Senior Systems Enginee...

Web resources about - How to create a connection between oracle database and the webform - asp.net.oracle

Connection - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

iMedia Connection: Interactive Marketing News, Features, Podcasts and Video - iMediaConnection.com
High-quality data, if not used properly, can still lead marketers to make bad decisions. Consider these common ways that numbers are used to ...

HTTP persistent connection - Wikipedia, the free encyclopedia
... tacked on to an existing protocol. If the browser supports keep-alive, it adds an additional header to the request: Following this, the connection ...

CareerSonar Turns Facebook Friends Into Job Connections
Looking for a job ? Among your Facebook friends lies the potential for employment. CareerSonar , a new service, brings together a person’s connections ...

The Direct Connection
... And the people reading my words respond back to me with words of their own. The technology that allows this is powerful but this direct connection ...

Is There A Connection Between Patrick Murphy's Over-The-Top Corruption And His Campaign Emails?
The DCCC may be stupid or even very stupid (as well as utterly incompetent) but their e-mail strategy is very well-planned out. Their overarching ...

CNN: Investigators Find ISIS Connection In San Bernardino Shooting
As the San Bernardino attack was happening, the female shooter, Tashfeen Malik posted on Facebook, pledging allegiance to ISIS leader Abu Bakr ...

Be Goofy, Smile At Your Baby: Protection Begins with Connection, Pediatrician Says
VideoPart 3 of a series Andrew Garner wears silly ties and finds it easy to make a goofy face. These are valuable tools for charming the babies ...

Mali arrests 2 in connection with deadly hotel attack
Mali arrests 2 in connection with deadly hotel attack

Get ready for live-streamed extreme sports: Seattle startup Sioeye adds 4G connection to action cam
The history of people doing crazy stunts on camera is full of notable achievements. Motorcycle daredevil Evel Knievel jumped over whatever he ...

Resources last updated: 12/5/2015 12:35:09 PM