PreviousArticleIs a demo about using oracleclient to access the Oracle database,
However, it seems that Microsoft has declared that it will give up its support for oracleclient since. Net 4.0,
So the following blog will introduce more methods for. Net accessing the Oracle database,
In fact, there are many ways to access the Oracle database, such as using ODBC,
Or oracleclient implementation, or oledb implementation,
Or through ORACLE data provider for. Net (ODP. net) provided by Oracle,
For the last ODP. net, you must add the components provided by Oracle,
Another interesting thing is that Oracle Developer Tools for Visual Studio provided by Oracle,
After installation, you can directly access the Oracle database in Visual Studio like SQL Server,
However, this blog post will only introduce oledb,
From ease to difficulty, we will introduce other methods for accessing the Oracle database later,
In fact, using oledb to access the Oracle database is very simple, just like using oracleclient in the previous blog,
Only some basic methods and classes are different, and then the connection string to the database is slightly changed,
It is also worth mentioning that when oracleclient accesses the Oracle database,
There is no need for too many data types in Oracle databases,
In oracleclient, there are some methods for getting values for Oracle Database types,
For example
When accessing oracle in oledb, you must control the data type conversion,
For example
Now let's take a look at the demo,
Let's take a look at the connection string first.
This demo achieves the same effect as the demo used to access the Oracle database using oracleclient in the previous article,
You can also log on with Scott and access the EMP data table in the database to obtain the data,
From the above we can see that this demo and the previous demo have no changes,
However, the following blog posts about how to access the Oracle database will be a little more complicated !!!