To write the connection string first
It can be written in web.config.
Copy Code code as follows:
<connectionStrings>
<add name= "Oracleson" connectionstring= "Data SOURCE=DINGSENORCL; Persist Security info=true; User Id=ds; Password=ds; Unicode=true "providername=" System.Data.OracleClient "/>
</connectionStrings>
<connectionStrings>
<add name= "Oracleson" connectionstring= "Data SOURCE=DINGSENORCL; Persist Security info=true; User Id=ds; Password=ds; Unicode=true "providername=" System.Data.OracleClient "/>
</connectionStrings>
And then call back in the background
Copy Code code as follows:
String Orclcon = configurationmanager.connectionstrings["Oracleson"]. ConnectionString;
String Orclcon = configurationmanager.connectionstrings["Oracleson"]. ConnectionString;
Then you want to create a new database connection object
Copy Code code as follows:
OracleConnection conn = new OracleConnection (Orclcon)
OracleConnection conn = new OracleConnection (Orclcon)
Create a OracleCommand object to manipulate the database
Copy Code code as follows:
OracleCommand cmd = conn. CreateCommand ()
OracleCommand cmd = conn. CreateCommand () Open connection
Conn. Open (), action on the line
Copy Code code as follows:
Cmd.commandtext = "INSERT into T_12 (AAAA) VALUES (: a)";
Cmd. Parameters.addwithvalue (": A", TextBox1.Text); Parameter replaces Oracle database with: SQL Server database is @
Cmd. ExecuteNonQuery ();
Cmd.commandtext = "INSERT into T_12 (AAAA) VALUES (: a)";
Cmd. Parameters.addwithvalue (": A", TextBox1.Text); Parameter replaces Oracle database with: SQL Server database is @
Cmd. ExecuteNonQuery ();