Oralce Version: 11g r2
1. Copy OCI. dll, ociw32.dll, Oracle. dataaccess. dll, orannzsbb11.dll, oraocci11.dll, oraociicus11.dll, and oraops11w. DLL to the bin directory.
2. Add a reference to Oracle. dataaccess. dll.
3. WriteCodeSuch:
View plaincopy to clipboardprint?
-
- UsingSystem;
-
- UsingSystem. Collections. Generic;
-
- UsingSystem. LINQ;
-
- UsingSystem. Web;
-
- UsingSystem. Web. UI;
- UsingSystem. Web. UI. webcontrols;
-
- UsingOracle. dataaccess. client;
-
-
- NamespaceOracle1
-
- {
-
- PublicPartialClass_ Default: system. Web. UI. Page
-
- {
- Protected VoidPage_load (ObjectSender, eventargs E)
-
- {
-
- StringConnstring ="Data Source = (description = (address = (Protocol = TCP) (host = 192.168.0.37) (Port = 1521 ))"+"(CONNECT_DATA = (SID = orcl); User ID = system; Password = ikmbikmb ;";
-
- Using(Oracleconnection conn =NewOracleconnection (connstring ))
-
- {
-
-
- Conn. open ();
-
-
- StringSQL ="Select * from T1 t";
-
- Using(Oraclecommand comm =NewOraclecommand (SQL, Conn ))
-
- {
-
-
- Using(Oracledatareader RDR = comm. executereader ())
- {
-
-
- While(RDR. Read ())
-
- {
-
- Response. Write (RDR. getstring (1) +"<Br>");
-
- }
-
-
- }
-
-
- }
-
-
- }
-
- }
-
- }
-
- }