1. Install odac (I installed xcopy);: http://www.oracle.com/technetwork/developer-tools/visual-studio/downloads/index.html
2. A 4.0-based application is started in vs2010.
3. WriteCode:
String Strconn = " Data Source = (description = (address = (Protocol = TCP) (host = 10.10.190.91) (Port = 1521) (CONNECT_DATA = (SID = orcl ))); user ID = rockuser; Password = rockuser; " ; // This can also be placed in Web. config, And the firewall should open 1521 ports.
String SQL = " Select * From org_userinfo " ;
Dataset DS = New Dataset ();
Using (ODC. oracleconnection myconn = New ODC. oracleconnection (strconn ))
{
Myconn. open ();
Using (ODC. oracledataadapter myda = New ODC. oracledataadapter (SQL, myconn ))
{
Myda. Fill (DS );
}
}
Gridview1.datasource = DS. Tables [ 0 ]. Defaultview;
Gridview1.databind ();
4. Remember to add oracle. dataaccess reference!
My oracle. dataaccess is in the C: \ oracle \ odp.net \ bin \ 4 path.
5. Remember to add oracle. dataaccess on the page!
Using ODC = oracle. dataaccess. client;
Sample Code: http://files.cnblogs.com/ewyb/OracleClient.zip