首先是添加ORACLE和SQL Server的引用(reference),ORACLE用的是它自带的类库

Imports
System.Data.SqlClient

Imports
Oracle.DataAccess.Client
在app.config里面设好connection string,具体如下:

<
appSettings
>

<
add key
=
“
SQLServerConnectionString
“
value
=
“
Data Source=MAPPA03C;Initial Catalog=LVSS;Integrated Security=True
“
/>

<
add key
=
“
OracleConnectionString
“
value
=
“
DATA SOURCE=lvnet;PASSWORD=lvss;PERSIST SECURITY INFO=False;USER ID=LVSS
“
/>

</
appSettings
>
然后便是在获得SQL Server和Oracle连接.

‘
——————————————————————–

‘
Function: GetSQLServerConn()

‘
Description: Implement the connection to SQL server database with the connection string in app.config

‘
Input:

‘
Remark:

‘
——————————————————————–


Public
Shared
Function GetSQLServerConn()
Function GetSQLServerConn() As SqlConnection








‘
——————————————————————–

‘
Function: GetOracleConn()

‘
Description: Implement the connection to oracle database with the connection string in app.config

‘
Input:

‘
Remark:

‘
——————————————————————–


Public
Shared
Function GetOracleConn()
Function GetOracleConn() As OracleConnection




转载于:https://www.cnblogs.com/iswszheng/archive/2009/04/23/1441954.html
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/110921.html原文链接:https://javaforall.net