nalla

nalla

  • NA
  • 1
  • 0

problem in connecting to oracle data in C# in windows 7

Jun 26 2010 2:20 AM
hello
this is the code i used to connect to the oracle database but it is not getting connected. Is there anything wrong in the code or i heard that in windows 7 the connection does not happen...can some one please help me

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OracleClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace WindowsFormsApplication9
{
    public partial class Form1 : Form
    {
        
       // OracleCommand cmd;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            OracleConnection con;
            string str = "Data Source=orcl;User Id=scott;Password=tiger;";
           con = new OracleConnection(str);
        
            con.Open();
            if (con.State == ConnectionState.Open)
            {
                MessageBox.Show("database connected");
            }
            else
            {
                MessageBox.Show("database not connected");
            }
        }

Answers (1)