ado连接数据库字符串大全.docx

上传人:b****1 文档编号:10948777 上传时间:2023-05-28 格式:DOCX 页数:22 大小:21.53KB
下载 相关 举报
ado连接数据库字符串大全.docx_第1页
第1页 / 共22页
ado连接数据库字符串大全.docx_第2页
第2页 / 共22页
ado连接数据库字符串大全.docx_第3页
第3页 / 共22页
ado连接数据库字符串大全.docx_第4页
第4页 / 共22页
ado连接数据库字符串大全.docx_第5页
第5页 / 共22页
ado连接数据库字符串大全.docx_第6页
第6页 / 共22页
ado连接数据库字符串大全.docx_第7页
第7页 / 共22页
ado连接数据库字符串大全.docx_第8页
第8页 / 共22页
ado连接数据库字符串大全.docx_第9页
第9页 / 共22页
ado连接数据库字符串大全.docx_第10页
第10页 / 共22页
ado连接数据库字符串大全.docx_第11页
第11页 / 共22页
ado连接数据库字符串大全.docx_第12页
第12页 / 共22页
ado连接数据库字符串大全.docx_第13页
第13页 / 共22页
ado连接数据库字符串大全.docx_第14页
第14页 / 共22页
ado连接数据库字符串大全.docx_第15页
第15页 / 共22页
ado连接数据库字符串大全.docx_第16页
第16页 / 共22页
ado连接数据库字符串大全.docx_第17页
第17页 / 共22页
ado连接数据库字符串大全.docx_第18页
第18页 / 共22页
ado连接数据库字符串大全.docx_第19页
第19页 / 共22页
ado连接数据库字符串大全.docx_第20页
第20页 / 共22页
亲,该文档总共22页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

ado连接数据库字符串大全.docx

《ado连接数据库字符串大全.docx》由会员分享,可在线阅读,更多相关《ado连接数据库字符串大全.docx(22页珍藏版)》请在冰点文库上搜索。

ado连接数据库字符串大全.docx

ado连接数据库字符串大全

ado连接数据库字符串大全

odbcdsnconnections3

odbcdsn-lessconnections4

odbcdriverforas/4004

odbcdriverforaccess4

odbcdriverfordbase4

odbcdriverforexcel5

odbcdriverformysql(viamyodbc)5

odbcdriverfororacle5

odbcdriverforparadox6

odbcdriverforsqlserver6

odbcdriverforsybase6

odbcdriverforsybasesqlanywhere7

odbcdriverforteradata7

odbcdriverfortext7

odbcdriverforvisualfoxpro7

oledbdatalinkconnections8

oledbproviderconnections8

oledbproviderforas/4008

oledbproviderforactivedirectoryservice8

oledbproviderfordb29

oledbproviderforindexserver9

oledbproviderforinternetpublishing9

oledbproviderformicrosoftjet9

excel10

text10

oledbproviderforodbcdatabases11

foraccess(jet):

11

forsqlserver:

11

oledbproviderfororacle(frommicrosoft)11

oledbproviderfororacle(fromoracle)11

oledbproviderforsimpleprovider12

oledbproviderforsqlserver12

remotedataservice(rds)connections13

rdsdatacontrol-connectproperty13

rdsdatacontrol-urlproperty14

adourlconnections14

msremoteproviderconnections15

msremote-access(jet)15

msremote-sqlserver16

datashapeproviderconnections17

.netmanagedproviderconnections17

sqlclient.netmanagedprovider17

withthe"sqlserveroledbprovider"(sqloledb).17

oledb.netmanagedprovider(system.data.oledb)18

odbc.netmanagedprovider(system.data.odbc)18

 

thispagecontainssampleadoconnectionstringsforodbcdsn/dsn-less,oledbproviders,remotedataservices(rds),msremote,msdatashape.alsoincludedareconnectionstringsforeach.netmanagedprovider(sqlclient,oledb,andodbc).thesesampleconnectionstringsarecompiledbycarlprothman,amicrosoftvisualbasicmvp.

 

tableofcontents

odbcdsnconnectionsdsn,filedsn

odbcdsn-lessconnections 

odbcdriverforas/400

odbcdriverforaccess

odbcdriverfordbase

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"programfoundinyourcomputer""""""""scontrolpanel(oradministrativetoolsmenuinwindows2000).makesuretocreateasystemdsn(notauserdsn)whenusingasp.

note:

youcanalsocreatethedsnviavbcode.

2)thenusethefollowingconnectionstring-withyourowndsnnameofcourse. ;-)

odbc-dsn

oconn.open"dsn=advworks;uid=admin;pwd=;

youcanalsocreateanduseafiledsn.thenusethefollowingadoconnectionstring:

odbc-filedsn

oconn.open"filedsn=c:

\somepath\mydb.dsn;uid=admin;pwd=;"

formoreinformation,see:

aboutodbcdatasourcesandhowtousefiledsnsanddsn-lessconnections

note:

theproblemwithdsnisthatuserscan(andwill)modifythem(ordeletebymistake),

thenyourprogramwon""""""""tworksowell...soit""""""""sbettertouseadsn-lessoroledbprovider

connectionstringwithatrustedconnectionifpossible!

 

odbcdsn-lessconnections

odbcdriverforas/400

oconn.open"driver={clientaccessodbcdriver(32-bit)};system=myas400;uid=myusername;pwd=mypassword;"

formoreinformation,see:

 afastpathtoas/400client/server

odbcdriverforaccess

forstandardsecurity:

oconn.open"driver={microsoftaccessdriver(*.mdb)};dbq=c:

\somepath\mydb.mdb;uid=admin;pwd=;"

ifyouareusingaworkgroup(systemdatabase):

oconn.open"driver={microsoftaccessdriver(*.mdb)};dbq=c:

\somepath\mydb.mdb;systemdb=c:

\somepath\mydb.mdw;admin",""

ifmdbislocatedonanetworkshare:

oconn.open"driver={microsoftaccessdriver(*.mdb)};dbq=\\myserver\myshare\mypath\mydb.mdb;"

formoreinformation,see:

microsoftaccessdriverprogrammingconsiderations

 

odbcdriverfordbase

oconn.open"driver={microsoftdbasedriver(*.dbf)};driverid=277;dbq=c:

\somepath;"

note:

specifythefilenameinthesqlstatement.forexample:

  ors.open"select*fromuser.dbf",oconn,,,adcmdtext

note:

mdac2.1(orgreater)requirestheborlanddatabaseengine(bde)toupdatedbasedbffiles.(q238431).formoreinformation,see:

dbasedriverprogrammingconsiderations

 

odbcdriverforexcel

oconn.open"driver={microsoftexceldriver(*.xls)};driverid=790;dbq=c:

\somepath\myspreadsheet.xls;defaultdir=c:

\somepath;"

formoreinformation,see:

microsoftexceldriverprogrammingconsiderations

 

odbcdriverformysql(viamyodbc)

toconnecttoalocaldatabase

oconn.open"driver={mysql};server=myservername;option=16834;database=mydb;"

toconnecttoaremotedatabase

oconn.open"driver={mysql};server=;port=3306;option=131072;stmt=;database=mydb;uid=myusername;pwd=mypassword;"

formoreinformation,see:

programsknowntoworkwithmyodbc

 

odbcdriverfororacle

forthecurrentoracleodbcdriverfrommicrosoft:

oconn.open"driver={microsoftodbcfororacle};server=oracleserver.world;uid=myusername;pwd=mypassword;"

fortheolderoracleodbcdriverfrommicrosoft:

oconn.open"driver={microsoftodbcdriverfororacle};connectstring=oracleserver.world;uid=myusername;pwd=mypassword;"

formoreinformation,see:

connectionstringformatandattributes

odbcdriverforparadox

oconn.open"driver={microsoftparadoxdriver(*.db)};driverid=538;fil=paradox5.x;defaultdir=c:

\dbpath\;dbq=c:

\dbpath\;collatingsequence=ascii;"

note:

mdac2.1(orgreater)requirestheborlanddatabaseengine(bde)toupdateparadoxisamfdbffiles.(q230126).

formoreinformation,see:

paradoxdriverprogrammingconsiderations

 

odbcdriverforsqlserver

forstandardsecurity:

oconn.open"driver={sqlserver};server=myservername;database=mydatabasename;uid=myusername;pwd=mypassword;"

fortrustedconnectionsecurity:

oconn.open"driver={sqlserver};server=myservername;database=mydatabasename;uid=;pwd=;"

或者

oconn.open"driver={sqlserver};server=myservername;database=mydatabasename;trusted_connection=yes;"

topromptuserforusernameandpassword

oconn.properties("prompt")=adpromptalways

oconn.open"driver={sqlserver};server=myservername;database=mydatabasename;"

formoreinformation,see:

sqldriverconnect(odbc)

 

odbcdriverforsybase

ifusingthesybasesystem11odbcdriver:

oconn.open"driver={sybasesystem11};srvr=myservername;uid=myusername;pwd=mypassword;"

ifusingtheintersolv3.10sybaseodbcdriver:

oconn.open"driver={intersolv3.1032-bitsybase};srvr=myservername;uid=myusername;pwd=mypassword;"

formoreinformation,see:

sybasesystem10odbcdriverreferenceguide

 

odbcdriverforsybasesqlanywhere

oconn.open"odbc;driver=sybasesqlanywhere5.0;defaultdir=c:

\dbpath\;dbf=c:

\sqlany50\mydb.db;uid=myusername;pwd=mypassword;"

note:

includingthedsntagwithanullstringisabsolutelycriticalorelseyougetthedreaded-7778error.

formoreinformation,see:

sybasesqlanywhereuserguide

 

odbcdriverforteradata

oconn.open"provider=teradata;dbcname=mydbcname;database=mydatabasename;uid=myusername;pwd=mypassword;"

formoreinformation,seeteradataodbcdriver

 

odbcdriverfortext

oconn.open"driver={microsofttextdriver(*.txt;*.csv)};dbq=c:

\somepath\;extensions=asc,csv,tab,txt;persistsecurityinfo=false"

note:

specifythefilenameinthesqlstatement.forexample:

ors.open"select*fromcustomer.csv",oconn,adopenstatic,adlockreadonly,adcmdtext

formoreinformation,see:

textfiledriverprogrammingconsiderations

 

odbcdriverforvisualfoxpro

withadatabasecontainer:

oconn.open"driver={microsoftvisualfoxprodriver};sourcetype=dbc;sourcedb=c:

\somepath\mysourcedb.dbc;exclusive=no;"

withoutadatabasecontainer(freetabledirectory):

oconn.open"driver={microsoftvisualfoxprodriver};sourcetype=dbf;sourcedb=c:

\somepath\mysourcedbfolder;exclusive=no;"

formoreinformation,see:

visualfoxproodbcdriverandq165492

 

oledbdatalinkconnections

datalinkfile(udl) 

forabsolutepath:

oconn.open"filename=c:

\somepath\mydatabasename.udl;"

forrelativepath:

oconn.open"filename=mydatabasename.udl;"

 

formoreinformation,see:

howto:

usedatalinkfileswithado

note:

windows2000nolongercontainsthe"new|microsoftdatalink"menuanymore.youcanaddthedatalinkmenubackinthemenulistbyrunningthe"c:

\programfiles\commonfiles\system\oledb\newudl.reg"regfile,thenright-clickonthedesktopandselect"new|microsoftdatalink"menu.oryoucanalsocreateadatalinkfilebycreatingatextfileandchangeit"sfileextensionto".

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

当前位置:首页 > 自然科学 > 物理

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2