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 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 information, see:

时间: 2024-12-03 20:30:13

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

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 (

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

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

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

[IOS]自己如何正确获取SQLite的ADO连接字符串

首先你正确安装了SQLite的数据库驱动程序(sqliteodbc.exe) 1.在桌面上新建一个空的文本文件SQLite.txt,重命名为SQLite.udl: 注1.1:SQLite.udl也可以通过别的方式得到,但必须是0字节的文件. 注1.2:系统文件没有扩展名,XP资源管理器中,菜单"工具"-->"文件夹选项"-->"查看"-->"隐藏已知文件类型的扩展名",前面的勾去掉就行了. 2.双击这个SQL

服务器-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