Connection to Oracle in ASP. NET:

Source: Internet
Author: User

Example of Oracle Database Connection, addition, deletion, modification, and query operations Code

1st Floor
Myconn = new system. Data. oledb. oledbconnection ("provider = msdaora.1; Data Source = oracle9; user id = test; Password = test ;")
2) Define and execute commands
Me. cmdinsert = new system. Data. oledb. oledbcommand ()
'Define and set the command attributes.
Me. cmdinsert. commandtext = "insert into table (name, old, Nation) values ('" & me. tname. text & "'," & "to_date ('" & me. told. text & "', 'dd/MM/yy')" & ",'" & me. tnation. text &"')"
Me. cmdinsert. commandtype = commandtype. Text
Me. cmdinsert. Connection = me. myconn
'Open the database connection
Me. myconn. open ()
'Call the executenonquery command to execute the INSERT command without return values.
Me. cmdinsert. executenonquery ()
Me. myconn. Close ()

2nd floor
(1) Connection
String strconn = "Data Source = source; user = sa; Password = sa ;";
Oracleconnection myconnection = new oracleconnection (strconn );
Myconnection. open ();
(2)
String strsel = "select * From table_name ";
Or strsel = "insert into table (ID, name) values ('1', '23 ')";
Or strsel = "delete from table where id = '1 '";
Oraclecommand mycom = new oraclecommand (strsel, myconnection );
Mycom. executenonreader ();
Myconnection. Close ();

Lanyahuhu (Sister Bao and sister lin, both of whom I like (calcium supplementation) on the third floor replied to-10-17 09:20:29 score 0 rows
26: String sconn = system. configuration. configurationsettings. deleettings ["dbconn"];
Row 27: m_conn = new oledbconnection (sconn );
Row 28: m_conn.open ();
The following error is reported:

Exception details: system. Data. oledb. oledbexception: Access denied.

the fourth floor of chinanewway (no trace of the new road) replied to 09:32:55 score 0 I know, or your database is not a trusted connection, you must enter
user ID and password to access the database, or your Oracle Database Service is not started.

Chinanewway on the fifth floor (no trace of the new road) replied to 09:37:27 score 0 in the web. config file can be added with the following key values:
<Deleetask>
<Add key = "oledbconnection. connectionstring "value =" packet size = 4096; user id = Lamis; Password = Lamis; Data Source = & quot; LAMIS-SERVER & quot; provider = sqloledb; persist Security info = false; initial catalog = Lamis; workstation id = sosore "/>
<Add key = "strconnection" value = "Data Source = LAMIS-SERVER; initial catalog = Lamis; persist Security info = false; user id = Lamis; Password = Lamis; workstation id = cxq; packet size = 4096 "type =" codeph "text ="/codeph "/>
</Appsettings>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.