SoFunction
Updated on 2025-03-09

Example code for oracle database operations

First, write the connection string

Can write it in

Copy the codeThe code is as follows:

<connectionStrings>
    <add name="oracleson" connectionString="Data Source=dingsenorcl;Persist Security Info=True;User ID=ds;Password=ds;Unicode=True" providerName=""/>
  </connectionStrings>

<connectionStrings>
    <add name="oracleson" connectionString="Data Source=dingsenorcl;Persist Security Info=True;User ID=ds;Password=ds;Unicode=True" providerName=""/>
  </connectionStrings>


Then call backend
Copy the codeThe code is as follows:

string orclcon = ["oracleson"].ConnectionString;

  string orclcon = ["oracleson"].ConnectionString;


Then create a new database connection object

Copy the codeThe code is as follows:

OracleConnection conn = new OracleConnection(orclcon)

OracleConnection conn = new OracleConnection(orclcon)


Create an OracleCommand object to operate on the database
Copy the codeThe code is as follows:

OracleCommand cmd = ()

OracleCommand cmd = () Open the connection


(); Just operate

Copy the codeThe code is as follows:

= "insert into T_12(AAAA)values(:a)";
(":a", );  //The parameter replacement of the oracle database must be used: the sqlserver database is @
                    ();

= "insert into T_12(AAAA)values(:a)";
(":a", );  //The parameter replacement of the oracle database must be used: the sqlserver database is @
                    ();