The C # function introduced below after connecting to the Oracle database is to change the records in the database and query the changed data. If you are interested in connecting to the Oracle database, take a look.
- Using System;
- Using System. Collections. Generic;
- Using System. ComponentModel; // you must add system. data. oracleclient
- Using 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 button#click (object sender, EventArgs e)
- {
- # Region is manually written from region to endregion. Others are automatically generated by the system.
- String constring = "data source = wzd; user = wzd; password = wzd;"; // define the string to connect to the database
- OracleConnection conn = new OracleConnection (constring); // connect
- Try
- {
- Conn. Open (); // Open the specified connection
- OracleCommand com = conn. CreateCommand ();
- Com. CommandText = "select name from fin_ipr_inmaininfo where card_no = '000000'"; // write the SQL statement that you want to execute
- OracleDataReader odr = com. ExecuteReader ();
- While (odr. Read () // Read data. If the returned value is false, it indicates the end of the record set.
- {
- This. lbl. Text = odr. GetOracleString (0). ToString (); // display the read value to the defined control.
- }
- Odr. Close (); // Close reader. This must be written.
- }
- Catch
- {
- MessageBox. Show ("erro"); // if an exception occurs, an error is prompted.
- }
- Finally
- {
- Conn. Close (); // Close the opened connection
- }
-
- # Endregion
- }
-
- Private void button2_Click (object sender, EventArgs e)
- {
- # Region is manually written from region to endregion. Others are automatically generated by the system.
- String constring = "data source = wzd; user = wzd; password = wzd;"; // define the string to connect to the database
- OracleConnection conn = new OracleConnection (constring); // connect
- Try
- {
- Conn. Open (); // Open the specified connection
- OracleCommand com = conn. CreateCommand ();
- Com. CommandText = "update fin_ipr_inmaininfo set name = 'wzd' where card_no = '000000'"; // write the SQL statement that you want to execute
- Com. ExecuteNonQuery ();
-
- }
- Catch
- {
- MessageBox. Show ("erro"); // if an exception occurs, an error is prompted.
- }
- Finally
- {
- Conn. Close (); // Close the opened connection
- }
-
- # Endregion
- }
- }
- }
C # connect to the Oracle database to query data
Oracle RMAN backup Optimization
Oracle backup using RMAN
Learn about Oracle OS backup
Provides you with an in-depth understanding of how ORACLE runs.