常用ADO连接数据库字符串大全文档格式.docx

上传人:b****7 文档编号:21829198 上传时间:2023-02-01 格式:DOCX 页数:18 大小:22.01KB
下载 相关 举报
常用ADO连接数据库字符串大全文档格式.docx_第1页
第1页 / 共18页
常用ADO连接数据库字符串大全文档格式.docx_第2页
第2页 / 共18页
常用ADO连接数据库字符串大全文档格式.docx_第3页
第3页 / 共18页
常用ADO连接数据库字符串大全文档格式.docx_第4页
第4页 / 共18页
常用ADO连接数据库字符串大全文档格式.docx_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

常用ADO连接数据库字符串大全文档格式.docx

《常用ADO连接数据库字符串大全文档格式.docx》由会员分享,可在线阅读,更多相关《常用ADO连接数据库字符串大全文档格式.docx(18页珍藏版)》请在冰豆网上搜索。

常用ADO连接数据库字符串大全文档格式.docx

ODBCDriverforExcel

ODBCDriverforMySQL

ODBCDriverforOracle

ODBCDriverforParadox

ODBCDriverforSQLServer

ODBCDriverforSybase

ODBCDriverforSybaseSQLAnywhere

ODBCDriverforText

ODBCDriverforTeradata

ODBCDriverforVisualFoxPro

OLEDBDataLinkConnectionsDataLinkFile(UDL)

OLEDBDataProviderConnections OLEDBProviderforAS/400

OLEDBProviderforActiveDirectoryService

OLEDBProviderforDB2

OLDDBProviderforInternetPublishing

OLEDBProviderforIndexServer

OLEDBProviderforMicrosoftJet

OLEDBProviderforODBCDatabases

OLEDBProviderforOracle(FromMicrosoft)

OLEDBProviderforOracle(FromOracle)

OLEDBProviderforSimpleProvider

OLEDBProviderforSQLServer

RemoteDataService(RDS)ConnectionsRDSDataControl-ConnectProperty

RDSDataControl-URLProperty

ADOURLConnectionsADORecordset

MSRemoteProviderConnectionsMSRemote-Access(Jet)

MSRemote-SQLServer

DataShapeProviderConnections MSDataShape-SQLServer

.NETManagedProviderConnectionsSQLClient.NETManagedProvider(System.Data.SqlClient)

OLEDB.NETManagedProvider(System.Data.OleDb)

ODBC.NETManagedProvider(System.Data.ODBC)

ODBCDSNConnections

UsinganODBCDSN(DataSourceName)isatwostepprocess.

1)YoumustfirstcreatetheDSNviathe"

ODBCDataSourceAdministrator"

program

foundinyourcomputer'

sControlPanel(orAdministrativeToolsmenuinWindows2000).

MakesuretocreateaSYSTEMDSN(notaUSERDSN)whenusingASP.

Note:

YoucanalsocreatetheDSNviaVBcode.

2)Thenusethefollowingconnectionstring-withyourownDSNnameofcourse. ;

-)

ODBC-DSN

oConn.Open"

DSN=AdvWorks;

"

&

_

         "

Uid=Admin;

Pwd=;

YoucanalsocreateanduseaFileDSN.ThenusethefollowingADOConnectionstring:

ODBC-FileDSN

FILEDSN=c:

\somepath\mydb.dsn;

Formoreinformation,see:

AboutODBCdatasourcesand

HowtoUseFileDSNsandDSN-lessConnections

TheproblemwithDSNisthatUserscan(andwill)modifythem(ordeletebymistake),

thenyourprogramwon'

tworksowell...Soit'

sbettertouseaDSN-LessorOLEDBProvider

connectionstringwithaTrustedConnectionifpossible!

ODBCDSN-LessConnections

ODBCDriverforAS/400

Driver={ClientAccessODBCDriver(32-bit)};

System=myAS400;

Uid=myUsername;

Pwd=myPassword;

 AFastPathtoAS/400Client/Server

ForStandardSecurity:

Driver={MicrosoftAccessDriver(*.mdb)};

Dbq=c:

\somepath\mydb.mdb;

IfyouareusingaWorkgroup(Systemdatabase):

SystemDB=c:

\somepath\mydb.mdw;

_

admin"

"

IfMDBislocatedonanetworkshare:

Dbq=\\myServer\myShare\myPath\myDb.mdb;

MicrosoftAccessDriverProgrammingConsiderations

Driver={MicrosoftdBASEDriver(*.dbf)};

        "

DriverID=277;

\somepath;

SpecifythefilenameintheSQLstatement.Forexample:

    oRs.Open"

Select*Fromuser.dbf"

oConn,,,adCmdText

MDAC2.1(orgreater)requirestheBorlandDatabaseEngine(BDE)toupdatedBaseDBFfiles.(Q238431).

dBASEDriverProgrammingConsiderations

Driver={MicrosoftExcelDriver(*.xls)};

DriverId=790;

\somepath\mySpreadsheet.xls;

DefaultDir=c:

MicrosoftExcelDriverProgrammingConsiderations

ODBCDriverforMySQL(viaMyODBC)

Toconnecttoalocaldatabase

Driver={mySQL};

Server=MyServerName;

Option=16834;

Database=mydb;

Toconnecttoaremotedatabase

Server=;

Port=3306;

Option=131072;

Stmt=;

ProgramsKnowntoWorkwithMyODBC

ForthecurrentOracleODBCDriverfromMicrosoft:

Driver={MicrosoftODBCforOracle};

Server=OracleServer.world;

FortheolderOracleODBCDriverfromMicrosoft:

Driver={MicrosoftODBCDriverforOracle};

ConnectString=OracleServer.world;

ConnectionStringFormatandAttributes

Driver={MicrosoftParadoxDriver(*.db)};

DriverID=538;

Fil=Paradox5.X;

\dbpath\;

CollatingSequence=ASCII;

MDAC2.1(orgreater)requirestheBorlandDatabaseEngine(BDE)toupdateParadoxISAMfDBFfiles.(Q230126).

ParadoxDriverProgrammingConsiderations

Driver={SQLServer};

        "

Database=myDatabaseName;

        "

ForTrustedConnectionsecurity:

Uid=;

'

or

Trusted_Connection=yes;

ToPromptuserforusernameandpassword

oConn.Properties("

Prompt"

)=adPromptAlways

DataBase=myDatabaseName;

  

SQLDriverConnect(ODBC)

IfusingtheSybaseSystem11ODBCDriver:

Driver={SYBASESYSTEM11};

Srvr=myServerName;

IfusingtheIntersolv3.10SybaseODBCDriver:

Driver={INTERSOLV3.1032-BITSybase};

SybaseSystem10ODBCDriverReferenceGuide

ODBC;

Driver=SybaseSQLAnywhere5.0;

Dbf=c:

\sqlany50\mydb.db;

Dsn="

;

IncludingtheDSNtagwithanullstringisabsolutelycriticalorelseyougetthedreaded-7778error.

SybaseSQLAnywhereUserGuide

Provider=Teradata;

DBCName=MyDbcName;

Database=MyDatabaseName;

Formoreinformation,seeTeradataODBCDriver

Driver={MicrosoftTextDriver(*.txt;

*.csv)};

\somepath\;

Extensions=asc,csv,tab,txt;

PersistSecurityInfo=False"

oRs.Open"

Select*Fromcustomer.csv"

       oConn,adOpenStatic,adLockReadOnly,adCmdText

TextFileDriverProgrammingConsiderations

Withadatabasecontainer:

Driver={MicrosoftVisualFoxProDriver};

SourceType=DBC;

SourceDB=c:

\somepath\mySourceDb.dbc;

Exclusive=No;

Withoutadatabasecontainer(FreeTableDirectory):

SourceType=DBF;

\somepath\mySourceDbFolder;

VisualFoxProODBCDriverandQ165492

OLEDBDataLinkConnections

DataLinkFile(UDL)

ForAbsolutePath:

FileName=c:

\somepath\myDatabaseName.udl;

ForRelativePath:

FileName=myDatabaseName.udl;

HOWTO:

UseDataLinkFileswithADO

Windows2000nolongercontainsthe"

New|MicrosoftDataLink"

menu 

anymore.YoucanaddtheDataLinkmenubackinthemenulistbyrunningthe

C:

\ProgramFiles\CommonFiles\System\OleDB\newudl.reg"

regfile,

thenright-clickonthedesktopandselect"

menu. 

OryoucanalsocreateaDataLinkfilebycreatingatextfileandchangeit'

s

fileextensionto"

.udl"

thendouble-clickthefile.

OLEDBProviderConnections

OLEDBProviderforAS/400

Provider=IBMDA400;

Datasource=myAS400;

UserId=myUsername;

         

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 艺术创意

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1