CREATE A CONNECTION TO ORACLE


/*It was written in C#*/

using System;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
 
namespace chekpassword
{
    public partial class loginForm : Form
    {
        public int isOk;
        public string UserName;
        public string DatabaseName;
        public loginForm()
        {
            InitializeComponent();
        }
       
        private void button1_Click(object sender, EventArgs e)
        {
            UserName = this.textBox1.Text;
            DatabaseName = this.comboBox1.Text;
            OracleConnection conn = new OracleConnection();
            conn.ConnectionString = "Data Source=" + DatabaseName +
                                    ";Persist Security Info=true;User ID=" + 
                                    this. UserName +
                                    ";Password=" + textBox2.Text + ";";
           try
            {
                conn.Open();
                isOk = 1;
                this.Close();
            }
            catch (Oracle.DataAccess.Client.OracleException err)
            {
                   MessageBox.Show(err.Message);
                   isOk = 0;
                   conn.Close();
            }
        }
    }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: