Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > Oracle
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 15th, 2008, 12:42 AM
MZA MZA is offline
Registered User
 
Join Date: Dec 2007
Location: Sylhet, , Bangladesh.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default C# and oracle

I can't connect oracle with C#.I use oracle 10g,ODP.NET,VS.net2005.
I add refferrence to Oracle.DataAccess
And this is my code:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.client;

namespace winOra
{
    public partial class frmShow : Form
    {
        public frmShow()
        {
            InitializeComponent();
        }

        private void btnShow_Click(object sender, EventArgs e)
        {


            string oradb = "Data Source=(DESCRIPTION=(ADDRESS_LIST="
                     + "(ADDRESS=(PROTOCOL=TCP)(HOST=OTNSRVR)(PORT=1521)) )"
                     + "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORC L)));"
                     + "User Id=ebezer;Password=ebazar;";

            OracleConnection conn = new OracleConnection(oradb);
            conn.Open();

            OracleCommand cmd = new OracleCommand();
            cmd.Connection = conn;
            cmd.CommandText = "select name from INFO where RegNo = 2003331009";
            cmd.CommandType = CommandType.Text;

            OracleDataReader dr = cmd.ExecuteReader();
            dr.Read();
            lblShow.Text = dr.GetString(0);

            conn.Dispose();
        }
    }
}
...........................
accualy i am extremly new!
Can any one help me,Plz?
  #2 (permalink)  
Old January 15th, 2008, 03:55 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

So waht does happen? Is there an error message etc?


--

Joe (Microsoft MVP - XML)
  #3 (permalink)  
Old January 15th, 2008, 05:27 AM
MZA MZA is offline
Registered User
 
Join Date: Dec 2007
Location: Sylhet, , Bangladesh.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

my compiler can't understand the last using statement:

using oracle.dataAccess;




  #4 (permalink)  
Old January 15th, 2008, 05:32 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

It should be
Code:
using Oracle.DataAccess.Client;
--

Joe (Microsoft MVP - XML)
  #5 (permalink)  
Old January 15th, 2008, 01:39 PM
MZA MZA is offline
Registered User
 
Join Date: Dec 2007
Location: Sylhet, , Bangladesh.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Joefawcett for your kind help.This problem is solved ,but another problem is introduced.I will message it later. I have not have much clear concept about the connection string.Can you please help me about this.

  #6 (permalink)  
Old January 16th, 2008, 04:08 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

There are examples at www.connectionstrings.com.

--

Joe (Microsoft MVP - XML)
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Oracle SOA, BPEL and Oracle worklist umeshtheone Pro Java 1 April 16th, 2008 11:01 PM
call oracle function using oracle link server vl SQL Server 2000 1 July 12th, 2007 08:19 AM
How to Read Oracle Data without Oracle being insta badrinarayanang Oracle 1 October 6th, 2005 06:34 AM
Connecting to Oracle without Oracle Client mahaveerar VB Databases Basics 0 February 22nd, 2005 05:18 PM
Connecting to Oracle without Oracle Client mahaveerar Excel VBA 0 February 22nd, 2005 03:55 PM



All times are GMT -4. The time now is 08:41 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.