0% found this document useful (0 votes)
25 views1 page

Try New: "Provider Msdaora Data Source Reach User ID Reach Password Reach Unicode True"

This document defines an OleDb connection string to an Oracle database called "reach". It then uses this connection string to open an OleDb connection and insert data from text boxes into a "customers" table, catching any exceptions.

Uploaded by

EngAhmadHoshieh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

Try New: "Provider Msdaora Data Source Reach User ID Reach Password Reach Unicode True"

This document defines an OleDb connection string to an Oracle database called "reach". It then uses this connection string to open an OleDb connection and insert data from text boxes into a "customers" table, catching any exceptions.

Uploaded by

EngAhmadHoshieh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

String connectionString;

connectionString= "provider=msdaora; Data Source = reach; User ID =


reach; Password = reach; Unicode = True";
try
{
OleDbConnection dbConn = new
OleDbConnection(connectionString);
//string sql = "insert into
customers(USERID,USERNAME,TELEPHONE,MOBILE,EMAIL,NATIONALID) values
('aoo','ahmad','dsds','dsa','[email protected]','dds')";
string sql = "insert into
customers(USERID,USERNAME,TELEPHONE,MOBILE,EMAIL,NATIONALID) values('" +
TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" +
TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "')";

OleDbCommand dbCommand = new OleDbCommand(sql, dbConn);


dbConn.Open();

OleDbDataAdapter adapter=new OleDbDataAdapter();


adapter.InsertCommand = dbCommand;

dbCommand.ExecuteNonQuery();
//DataSet customers = new DataSet();
//adapter.Fill(customers, "Customers");
}
catch (OleDbException ex)
{
//MessageBox.Show(ex.ToString(), "Database Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
//returnValue = false;
}

You might also like