实现ORACLE和SQL Server连接

实现ORACLE和SQL Server连接

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

实现ORACLE和SQL Server连接
Imports
 System.Data.SqlClient
实现ORACLE和SQL Server连接

Imports
 Oracle.DataAccess.Client

 

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

实现ORACLE和SQL Server连接
 
<
appSettings 
>

实现ORACLE和SQL Server连接    

<
add key 
=

SQLServerConnectionString

 value
=

Data Source=MAPPA03C;Initial Catalog=LVSS;Integrated Security=True

/>

实现ORACLE和SQL Server连接    

<
add key 
=

OracleConnectionString

 value 
=

DATA SOURCE=lvnet;PASSWORD=lvss;PERSIST SECURITY INFO=False;USER ID=LVSS

  
/>

实现ORACLE和SQL Server连接  

</
appSettings
>



 

然后便是在获得SQL Server和Oracle连接.

实现ORACLE和SQL Server连接
    

——————————————————————–

实现ORACLE和SQL Server连接

    

Function:        GetSQLServerConn()

实现ORACLE和SQL Server连接

    

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

实现ORACLE和SQL Server连接

    

Input:                

实现ORACLE和SQL Server连接

    

Remark:                  

实现ORACLE和SQL Server连接

    

——————————————————————–

ExpandedBlockStart.gifContractedBlock.gif

    
Public
 
Shared
 
Function GetSQLServerConn()
Function GetSQLServerConn() As SqlConnection
实现ORACLE和SQL Server连接        
Dim conn As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings(SQLServerConnectionString))
实现ORACLE和SQL Server连接        conn.Open()
实现ORACLE和SQL Server连接        
Return conn
实现ORACLE和SQL Server连接
实现ORACLE和SQL Server连接    
End Function


实现ORACLE和SQL Server连接
实现ORACLE和SQL Server连接
实现ORACLE和SQL Server连接    


——————————————————————–

实现ORACLE和SQL Server连接

    

Function:        GetOracleConn()

实现ORACLE和SQL Server连接

    

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

实现ORACLE和SQL Server连接

    

Input:                

实现ORACLE和SQL Server连接

    

Remark:                  

实现ORACLE和SQL Server连接

    

——————————————————————–

ExpandedBlockStart.gifContractedBlock.gif

    
Public
 
Shared
 
Function GetOracleConn()
Function GetOracleConn() As OracleConnection
实现ORACLE和SQL Server连接        
Dim conn As New OracleConnection(System.Configuration.ConfigurationManager.AppSettings(OracleConnectionString))
实现ORACLE和SQL Server连接        conn.Open()
实现ORACLE和SQL Server连接        
Return conn
实现ORACLE和SQL Server连接    
End Function

转载于:https://www.cnblogs.com/iswszheng/archive/2009/04/23/1441954.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/110921.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • stm32中u8,u16,u32的理解_常用stm32是什么型号

    stm32中u8,u16,u32的理解_常用stm32是什么型号http://www.51hei.com/bbs/dpj-27167-1.html在KeilMDK开发环境里,比如一个无符号32位整形数据会有很多种表示方法:1.unsignedint32(C语言标准表达方法)    2.uint32_t;      3.u32;  这三种方式都是在表达同一个意思。可为什么ST的开发人员要搞的这么乱呢? 其实ST搞这

    2022年8月31日
    5
  • 网站备案常见词汇解释汇总

    网站备案常见词汇解释汇总ICP 备案 ICP 备案是由工信部发布的许可证 如果需要在中国大陆地区托管网站 或者开通 CDN 服务 就必须申请 ICP 互联网内容提供商 备案 ICP 备案号 ICP 备案号是指对于单纯的资讯性网站 需要申请 ICP 备案号 腾讯云服务器用户需通过腾讯云提交申请 接入商接入商是指网站搭建平台并协助办理备案的提供者 经营性 ICP 许可证经营性 ICP 许可证是指对于商品或服务的在线

    2025年7月28日
    2
  • 多线程锁有几种类型_线程互斥和同步的区别

    多线程锁有几种类型_线程互斥和同步的区别一、同步与互斥的概念  现代操作系统基本都是多任务操作系统,即同时有大量可调度实体在运行。在多任务操作系统中,同时运行的多个任务可能:都需要访问/使用同一种资源;多个任务之间有依赖关系,某个任务的运行依赖于另一个任务。【同步】:  是指散步在不同任务之间的若干程序片断,它们的运行必须严格按照规定的某种先后次序来运行,这种先后次序依赖于要完成的特定的任务。最基本的场景就是:两个或两个以…

    2025年8月7日
    3
  • 小程序:matlab解微分方程「建议收藏」

    functionf=ball_trajectory(t,y);g=9.81;pi=3.14159265;air_density=1.20;M=57.5*0.001;D=64.0*0.001;R=D*0.5;A=pi*R*R;Cd=0.507;ratio_Cl_to_S=0.5

    2022年4月16日
    42
  • 如何在ASP.NET MVC中获取客户端的IP地址?

    如何在ASP.NET MVC中获取客户端的IP地址?I’mtotallynewtotheASP.NETMVCstack,andIwaswonderingwhathappenedtothesimplePageobje

    2022年7月22日
    10
  • DataGrip2022.01.12激活码【中文破解版】[通俗易懂]

    (DataGrip2022.01.12激活码)好多小伙伴总是说激活码老是失效,太麻烦,关注/收藏全栈君太难教程,2021永久激活的方法等着你。IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html2KLKA7BQFO-eyJsaWNlbnNlSW…

    2022年4月1日
    159

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号