C # connecting Oracle databases can implement many of the features we need, and here's how C # connects Oracle database query data, and if you're interested in C # connecting to Oracle database, you might want to take a look at this.
Using System; Using System.Collections.Generic; Using System.ComponentModel using system.data.oracleclient;;/ /This line and next line must first fill in the reference to add system.data.oracleclient using System.Data; Using System.Drawing; Using System.Text; Using System.Windows.Forms; namespace WindowsApplication1 {public partial class Form1:form {public Form1 () { InitializeComponent (); private void Button1_Click (object sender, EventArgs e) {#region from region to Endreg Ion is written by hand. Everything else is automatically generated by the system string constring = "Data source=wzd;user=wzd;password=wzd;"; /define a string to connect to the database OracleConnection conn = new OracleConnection (constring);//Make connection try { Conn. Open ();//Opens the specified connection oraclecommand COM = conn. CreateCommand (); Com. CommandText = "SELECT name from MyTable where card_no= ' 0000000002 '";//write good SQL statement to execute OracleDataReader ODR = Com. ExecutereadER (); while (ODR. Read ())//reads the data and, if returned to false, indicates to the end of the recordset {This.lbl.Text = ODR. Getoraclestring (0). ToString ();//The value read to is displayed in the defined control. } ODR. Close ();//Turn reader off. This is a must-write} catch {MessageBox.Show ("Erro");//If the hair Error} finally {Conn. Close ();//Closes Open connection} #endregion}}}
C # connecting Oracle database query data