Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->编程语言 ->ASP ->正文

ADO连接数据库字符串大全

来源:Linuxdby.com 作者:Webmaster 时间:2007-04-23 点击: [收藏] [投稿]

For more information, see: System.Data.OleDb Namespace and .NET Data Providers
Note: 'ADO' namespace got renamed to 'OleDb'

ODBC .NET Managed Provider (System.Data.ODBC)
 
The ODBC .NET Data Provider is an add-on component to the .NET Framework SDK Beta 2.
It provides access to native ODBC drivers the same way the OLE DB .NET Data Provider
provides access to native OLE DB providers.

For SQL Server ODBC Driver:

Dim oODBCConnection As Odbc.OdbcConnection
Dim sConnString As String

' Create and open a new ODBC Connection
sConnString = "Driver={SQL Server};" & _
           "Server=MySQLServerName;" & _
           "Database=MyDatabaseName;" & _
           "Uid=MyUsername;" & _
           "Pwd=MyPassword;"

oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()

For Oracle ODBC Driver:

Dim oODBCConnection As Odbc.OdbcConnection
Dim sConnString As String

' Create and open a new ODBC Connection
sConnString = "Driver={Microsoft ODBC for Oracle};" & _
          "Server=OracleServer.world;" & _
          "Uid=myUsername;" & _
          "Pwd=myPassword;"

oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()

For Access (JET) ODBC Driver:

Dim oODBCConnection As Odbc.OdbcConnection
Dim sConnString As String

' Create and open a new ODBC Connection
sConnString = "Driver={Microsoft Access Driver (*.mdb)};" & _
          "Dbq=c:\somepath\mydb.mdb;" & _
          "Uid=Admin;" & _
          "Pwd=;"

oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()

For all other ODBC Drivers:

Dim oODBCConnection As Odbc.OdbcConnection
Dim sConnString As String

' Create and open a new ODBC Connection
sConnString = "Dsn=myDsn;" & _
           "Uid=myUsername;" & _
           "Pwd=myPassword;"

oODBCConnection = New Odbc.OdbcConnection(sConnString)
oODBCConnection.Open()

For more information, see: Download Center






 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:树型结构在ASP中的简单解决   下一篇:货币大写转换函数的更新

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
·从本质上看网页(asp,jsp)的编写
·学以致用 驳“ASP低能论”
·用VB构建Internet的应用
·Asp的安全管理(12)
·Windows 2000 安全性技术概述--3
·Windows 2000 安全性技术概述--2
·Windows 2000 安全性技术概述--1
·ActiveX技术综述(二) 
·ActiveX技术综述(一) 
·动态网页技术--CGI:ASP:JSP:PHP(4)
推荐文章
精彩文章
Power by linux-cn.com 粤ICP备05006655号