ADO连接数据库字符串大全

ado|连接数据库|字符串

ADO连接数据库字符串大全

This page contains sample ADO connection strings for ODBC DSN / DSN-Less,
OLE DB Providers, Remote Data Services (RDS), MS Remote, MS DataShape.

Also included are ADO.NET connection strings for each .NET Managed Provider
(SQLClient, OLEDB, and ODBC).

These sample connection strings are compiled
by Carl Prothman, a Microsoft Visual Basic MVP
Enjoy!

 
Table of Contents
ODBC DSN Connections DSN
File DSN

ODBC DSN-Less Connections  ODBC Driver for AS/400
ODBC Driver for Access
ODBC Driver for dBASE
ODBC Driver for Excel
ODBC Driver for MySQL
ODBC Driver for Oracle
ODBC Driver for Paradox
ODBC Driver for SQL Server
ODBC Driver for Sybase
ODBC Driver for Sybase SQL Anywhere
ODBC Driver for Text
ODBC Driver for Teradata
ODBC Driver for Visual FoxPro

OLE DB Data Link Connections Data Link File (UDL)

OLE DB Data Provider Connections  OLE DB Provider for AS/400
OLE DB Provider for Active Directory Service
OLE DB Provider for DB2
OLD DB Provider for Internet Publishing
OLE DB Provider for Index Server
OLE DB Provider for Microsoft Jet
OLE DB Provider for ODBC Databases
OLE DB Provider for Oracle (From Microsoft)
OLE DB Provider for Oracle (From Oracle)
OLE DB Provider for Simple Provider
OLE DB Provider for SQL Server

Remote Data Service (RDS) Connections RDS Data Control - Connect Property
RDS Data Control - URL Property

ADO URL Connections ADO Recordset

MS Remote Provider Connections MS Remote - Access (Jet)
MS Remote - SQL Server

Data Shape Provider Connections  MS DataShape - SQL Server

.NET Managed Provider Connections SQL Client .NET Managed Provider (System.Data.SqlClient)
OLE DB .NET Managed Provider (System.Data.OleDb)
ODBC .NET Managed Provider (System.Data.ODBC)

 

ODBC DSN Connections
Using an ODBC DSN (Data Source Name) is a two step process.

1) You must first create the DSN via the "ODBC Data Source Administrator" program
found in your computer's Control Panel (or Administrative Tools menu in Windows 2000).
Make sure to create a SYSTEM DSN (not a USER DSN) when using ASP.
Note: You can also create the DSN via VB code.

2) Then use the following connection string - with your own DSN name of course.  ;-)

ODBC - DSN
 
oConn.Open "DSN=AdvWorks;" & _
          "Uid=Admin;" & _
          "Pwd=;

You can also create and use a File DSN. Then use the following ADO Connection string:

ODBC - File DSN
 
oConn.Open "FILEDSN=c:\somepath\mydb.dsn;" & _
          "Uid=Admin;" & _
          "Pwd=;"

For more information, see: About ODBC data sources and
How to Use File DSNs and DSN-less Connections

Note: The problem with DSN is that Users can (and will) modify them (or delete by mistake),
then your program won't work so well... So it's better to use a DSN-Less or OLE DB Provider
connection string with a Trusted Connection if possible!

ODBC DSN-Less Connections
ODBC Driver for AS/400
 
oConn.Open "Driver={Client Access ODBC Driver (32-bit)};" & _
          "System=myAS400;" & _
          "Uid=myUsername;" & _
          "Pwd=myPassword;"

For more information, see:  A Fast Path to AS/400 Client/Server

ODBC Driver for Access
 
For Standard Security:

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
          "Dbq=c:\somepath\mydb.mdb;" & _
          "Uid=Admin;" & _
          "Pwd=;"

If you are using a Workgroup (System database):

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
          "Dbq=c:\somepath\mydb.mdb;" & _
          "SystemDB=c:\somepath\mydb.mdw;", _
          "admin", ""

If MDB is located on a network share:

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
          "Dbq=\\myServer\myShare\myPath\myDb.mdb;"

For more inform

时间: 2024-10-30 04:08:03

ADO连接数据库字符串大全的相关文章

ADO连接数据库字符串大全(VP,Excel,文本,Sybase,.NET等)

ado|excel|连接数据库|字符串 ADO连接数据库字符串大全(VP,Excel,文本,Sybase,.NET等) This page contains sample ADO connection strings for ODBC DSN / DSN-Less,OLE DB Providers, Remote Data Services (RDS), MS Remote, MS DataShape. Also included are ADO.NET connection strings f

ADO.NET 连接数据库字符串小结

ADO.NET  连接到 SQL Server  SQL Server .NET Framework 数据提供程序支持类似于 OLE DB (ADO) 连接字符串格式的连接字符串格式. 复制代码代码如下: using (SqlConnection connection = new SqlConnection(connectionString))  {  connection.Open();  // Do work here.  }  连接到 OLE DB 数据源  OLE DB .NET Fra

服务器-Visual 6.0 ADO连接数据库的问题

问题描述 Visual 6.0 ADO连接数据库的问题 SQL server 2008服务器名字为local时 连接字符串中的 服务器名字应该写什么,为什么写local不对呢? 解决方案 写.(一个点),localhost,127.0.0.1等,分别试试看. 解决方案二: ADO连接Access数据库连接字符串问题VC6.0 通过ado连接access数据库

用ADO连接数据库的三种方法及其性能比较

ado|比较|连接数据库|性能    ADO连接数据库通常有三种方法:System DSN Connection,DSN-less Connection 和 OLE DB Connection,这是大家都很熟悉的,它们的使用方法如下:      (注:三种方法的区别在于使用的是哪个关键字 - DSN,Driver,Data Source,Provider.UID,PWD 是 ODBC 的标记,User ID,Password 是 OLEDB 的标记.特别指出的是 Data Source 在 OD

ado连接数据库模块

ado|连接数据库 加入这个模块后,在程序中任意地方调用: 打开ado数据库连接:Call CnnDB(mcnn, sCnn, True) 关闭ado数据库连接:Call DisCnn(mcnn) 这样,让数据库连接更加方便被连接和关闭 '%#******************************************'%#*窗体名称:MdlDB'%#*功能描述:加入这个模块后调用 Call CnnDB(gcnnDB, sCnn, True) '%#*作者: 宁彦彬'%#*修改日期:20

ado-Vb.net 使用AdO连接数据库错误

问题描述 Vb.net 使用AdO连接数据库错误 以下代码为什么老在 Cnn.open(CnnStr) 显示 "未找到提供程序.该程序可能未正确安装."? 已经有引用ADODB. Imports System.Data.OleDb Imports ADODB Dim Cnn As New ADODB.Connection Dim Rs As New ADODB.Recordset Dim CnnStr As String = "Provider= Microsoft.Jet.

ado连接sql数据库-求大神帮忙,ado连接数据库sql server 2005,总是失败

问题描述 求大神帮忙,ado连接数据库sql server 2005,总是失败 #include #include #include #include #import "C:Program FilesCommon FilesSystemadomsado15.dll" no_namespace rename("EOF","ADOEOF") int main() { if(!AfxOleInit()) { AfxMessageBox("ca

c++-ado 连接数据库,能从异常或者返回值里区分出 异常产生的原因吗

问题描述 ado 连接数据库,能从异常或者返回值里区分出 异常产生的原因吗 想知道哪些原因引起的数据库连接失败,如:断网,sql语句错误,数据库问题... 解决方案 断网或者数据库服务器异常一般很难确定出来到底是哪个,因为会报同意异常:连接超时,没有多余提示!其他sql错误之类的一眼就能看出吧 解决方案二: 可以,根据异常类型和异常消息.各种数据库的异常和消息各有不同.理论上应该是可以明确的

来看看这样一个问题 用ado连接数据库的问题 请看下面图片

问题描述 来看看这样一个问题 用ado连接数据库的问题 请看下面图片 这是前台的方法 后台登录数据库有什么问题呢 语法有什么问题 总是登录失败 而且文本框中的值一直是为空的 解决方案 密码输入框的名称获取对没有?再用this点看看