Neha Alam

Neha Alam

  • NA
  • 3
  • 0

showing data in richtextbox from oracle dbms

Jul 3 2009 3:24 AM

hello
i want to select some data from a table stored in oracle dbms in a rich textbox while clicking HR button. how to do it. I am attaching my code here. Also is my conncetion to oracle alright? I am attching my code:
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
using
System.Data.OleDb;
using
System.Data.OracleClient;
namespace
WindowsFormsApplication1
{
public partial class Formb : Form
{
OracleConnection oracleConect = null;
void createConnection()
{

}
public Formb()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string connectStr = "Data Source=xe;Persist Security Info=True;User ID=system;Password=kuetcse;Unicode=True";
oracleConect =
new OracleConnection(connectStr);
oracleConect.Open();
string queryss = "select * from hr";
OracleCommand command = oracleConect.CreateCommand();
command.Connection = oracleConect;
command.CommandText = queryss;
command.ExecuteNonQuery();
OracleDataReader reader = command.ExecuteReader();

if (reader!=null)
{
richTextBox1.Text =
"sucess";
}
else
{
richTextBox1.Text =
"no conncetion";

}
}
private void button2_Click(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
}
private void button5_Click(object sender, EventArgs e)
{
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
}
}
}