Creating a Class Library in VB.NET

假装没事ソ 提交于 2020-01-15 11:47:05

问题


I need to create a class library in VB.NET that will connect to an Oracle database.

I would then be executing some functions to retrieve informations from a database.

I would then need to utilize this class in ASP.Net 2.0 project.

Would someone care to point me in the right direction in achieving this?

Thanks.


回答1:


When I had to create a library just for dealing with database for the first time; I wasn't sure how to get started since I didn't know exact terminology to search for.

If you search for how to create "DAL" (Data Access Layer), you should be able to find out many many ways to achieve what you are looking for.

Usually DAL is independent of where it is being used so that you can use it in ASP.NET, or WinForms or WPF, etc. And also you can write DAL in a way that you don't have to worry about whether you are connecting to Oracle or other RDBMS.

Anyways, the keyword here is DAL




回答2:


You have two options; System.Data.OracleClient from Microsoft and ODP.NET. Personally, I prefer ODP.NET but System.Data.OracleClient will get the job done.

If you're familiar with connecting to other databases using ADO.NET, you will find that connecting to Oracle is no different -- Connection, Command, Reader, etc.

Basic ODP.NET Samples http://www.oracle.com/technology/sample_code/tech/windows/odpnet/odpbasic.html




回答3:


This site gives a break down of how to build a connection string for the different providers you can use to connect to an oracle database.



来源:https://stackoverflow.com/questions/600962/creating-a-class-library-in-vb-net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!