C # improving the knowledge of ADO. NET object data model (1) (1)

Source: Internet
Author: User

I recently used the ado.net Data model to connect to Oracle. I have been directly using OleDbConnection in the System. Data namespace to directly execute SQL statements.
(Http://blog.csdn.net/yysyangyangyangshan/article/details/6999304) generally write SQL statements directly, and then call the corresponding execution method can be, return data to save with dataTable. However, in. net framework4.0, for example, OracleCommand will prompt that it is out of date, so use ADO.net. The following describes how to connect to Oracle using the ADO. NET object data model. However, here Oracle must have ODA. NET, or else it cannot be connected successfully.
1. Create a project in the project.

 

2. Select the ADO. NET object data model.

 

3. Select by image. If you want to customize the model, select null.

 

4. Here is the new database connection, because this is the connection I have selected last time, so I am prompted for a connection. If you want to modify it, click New connection. The object connection name is Entity by default, it can also be modified as needed.

 

5. Click Create connection and select change to change different databases.

 

6. Select a database.

 

7. Enter the database name, user name, and password as required.

 

8. after entering the information, click test connection. If the message "connection successful" is displayed, the connection is OK.

 

9. Click 'Next' and select the model you want to generate.

 

10. The page loads the object.

 

 

Related Article

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.