2022年ADO连接字符串大全[归 .pdf





《2022年ADO连接字符串大全[归 .pdf》由会员分享,可在线阅读,更多相关《2022年ADO连接字符串大全[归 .pdf(21页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、标题ADO 连接字符串大全选择自bohut 的 Blog关键字ADO 连接字符串大全出处This page contains sampleADO 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).Thesesample connect
2、ion strings are compiledby Carl Prothman,a Microsoft Visual Basic MVPEnjoy!Table of ContentsODBC DSN Connections DSNFile DSNODBC DSN-Less ConnectionsODBC Driver for AS/400ODBC Driver for AccessODBC Driver for dBASEODBC Driver for ExcelODBC Driver for MySQLODBC Driver for OracleODBC Driver for Parado
3、xODBC Driver for SQL ServerODBC Driver for SybaseODBC Driver for SybaseSQL AnywhereODBC Driver for TextODBC Driver for TeradataODBC Driver for Visual FoxProOLE DB Data Link Connections Data Link File(UDL)OLE DB Data Provider ConnectionsOLE DB Provider for AS/400OLE DB Provider for Active Directory S
4、erviceOLE DB Provider for DB2OLD DB Provider for Internet PublishingOLE DB Provider for Index ServerOLE DB Provider for Microsoft JetOLE DB Provider for ODBC DatabasesOLE DB Provider for Oracle(From Microsoft)OLE DB Provider for Oracle(From Oracle)OLE DB Provider for Simple Provider名师资料总结-精品资料欢迎下载-名
5、师精心整理-第 1 页,共 21 页 -OLE DB Provider for SQL ServerRemote Data Service(RDS)Connections RDS Data Control-Connect PropertyRDS Data Control-URL PropertyADO URL Connections ADO RecordsetMS Remote Provider Connections MS Remote-Access(Jet)MS Remote-SQL ServerData ShapeProvider ConnectionsMS DataShape-SQL
6、Server.NETManagedProviderConnectionsSQLClient.NETManagedProvider(System.Data.SqlClient)OLE DB.NET Managed Provider(System.Data.OleDb)ODBC.NET Managed Provider(System.Data.ODBC)ODBC DSN ConnectionsUsing an ODBC DSN(Data Source Name)is atwo step process.1)You must first create the DSN via the ODBC Dat
7、a SourceAdministratorprogramfound in your computers Control Panel(or Administrative Tools menu in Windows 2000).Make sure to createaSYSTEM DSN(not a USER DSN)when using ASP.Note:You can also create the DSN via VB code.2)Then usethe following connection string-with your own DSN name of course.;-)ODBC
8、-DSNoConn.Open DSN=AdvWorks;&_Uid=Admin;&_Pwd=;You can also create andusea File DSN.Then usethe following ADO Connection string:ODBC-File DSNoConn.Open FILEDSN=c:somepathmydb.dsn;&_Uid=Admin;&_Pwd=;For more information,see:About ODBC data sourcesandHow to Use File DSNs andDSN-less Connections名师资料总结-
9、精品资料欢迎下载-名师精心整理-第 2 页,共 21 页 -Note:The problem with DSN is that Users can(and will)modify them(or delete by mistake),then your program wont work so well.So its better to usea DSN-Less or OLE DB Providerconnection string with a Trusted Connection if possible!ODBC DSN-Less ConnectionsODBC Driver for A
10、S/400oConn.Open Driver=ClientAccess ODBC Driver(32-bit);&_System=myAS400;&_Uid=myUsername;&_Pwd=myPassword;For more information,see:A Fast Path to AS/400 Client/ServerODBC Driver for AccessFor Standard Security:oConn.Open Driver=MicrosoftAccessDriver(*.mdb);&_Dbq=c:somepathmydb.mdb;&_Uid=Admin;&_Pwd
11、=;If you are using aWorkgroup(System database):oConn.Open Driver=MicrosoftAccessDriver(*.mdb);&_Dbq=c:somepathmydb.mdb;&_SystemDB=c:somepathmydb.mdw;,_admin,If MDB is located on a network share:oConn.Open Driver=MicrosoftAccessDriver(*.mdb);&_Dbq=myServermySharemyPathmyDb.mdb;For more information,se
12、e:Microsoft Access Driver Programming ConsiderationsODBC Driver for dBASEoConn.Open Driver=MicrosoftdBASE Driver(*.dbf);&_DriverID=277;&_Dbq=c:somepath;名师资料总结-精品资料欢迎下载-名师精心整理-第 3 页,共 21 页 -Note:Specify the filename in the SQL statement.For example:oRs.Open Select*From user.dbf,oConn,adCmdTextNote:MD
13、AC 2.1(or greater)requires the Borland Database Engine(BDE)to update dBase DBFfiles.(Q238431).For more information,see:dBASE Driver Programming ConsiderationsODBC Driver for ExceloConn.Open Driver=MicrosoftExcel Driver(*.xls);&_DriverId=790;&_Dbq=c:somepathmySpreadsheet.xls;&_DefaultDir=c:somepath;F
14、or more information,see:Microsoft Excel Driver Programming ConsiderationsODBC Driver for MySQL(via MyODBC)To connect to a local databaseoConn.Open Driver=mySQL;&_Server=MyServerName;&_Option=16834;&_Database=mydb;To connect to a remote databaseoConn.Open Driver=mySQL;&_Server=;&_Port=3306;&_Option=1
15、31072;&_Stmt=;&_Database=mydb;&_Uid=myUsername;&_Pwd=myPassword;For more information,see:Programs Known to Work with MyODBCODBC Driver for Oracle名师资料总结-精品资料欢迎下载-名师精心整理-第 4 页,共 21 页 -For the current Oracle ODBC Driver from Microsoft:oConn.Open Driver=MicrosoftODBC for Oracle;&_Server=OracleServer.wor
16、ld;&_Uid=myUsername;&_Pwd=myPassword;For the older Oracle ODBC Driver from Microsoft:oConn.Open Driver=MicrosoftODBC Driver for Oracle;&_ConnectString=OracleServer.world;&_Uid=myUsername;&_Pwd=myPassword;For more information,see:Connection String Format andAttributesODBC Driver for ParadoxoConn.Open
17、 Driver=MicrosoftParadox Driver(*.db);&_DriverID=538;&_Fil=Paradox 5.X;&_DefaultDir=c:dbpath;&_Dbq=c:dbpath;&_CollatingSequence=ASCII;Note:MDAC2.1(or greater)requires the Borland Database Engine(BDE)to update ParadoxISAM fDBF files.(Q230126).For more information,see:Paradox Driver Programming Consid
18、erationsODBC Driver for SQL ServerFor Standard Security:oConn.Open Driver=SQLServer;&_Server=MyServerName;&_Database=myDatabaseName;&_Uid=myUsername;&_Pwd=myPassword;For Trusted Connection security:名师资料总结-精品资料欢迎下载-名师精心整理-第 5 页,共 21 页 -oConn.Open Driver=SQLServer;&_Server=MyServerName;&_Database=myDa
19、tabaseName;&_Uid=;&_Pwd=;oroConn.Open Driver=SQLServer;&_Server=MyServerName;&_Database=myDatabaseName;&_Trusted_Connection=yes;To Prompt user for usernameand passwordoConn.Properties(Prompt)=adPromptAlwaysoConn.Open Driver=SQLServer;&_Server=MyServerName;&_DataBase=myDatabaseName;For more informati
20、on,see:SQLDriverConnect(ODBC)ODBC Driver for SybaseIf using the SybaseSystem 11 ODBC Driver:oConn.Open Driver=SYBASESYSTEM 11;&_Srvr=myServerName;&_Uid=myUsername;&_Pwd=myPassword;If using the Intersolv 3.10 SybaseODBC Driver:oConn.Open Driver=INTERSOLV3.10 32-BIT Sybase;&_Srvr=myServerName;&_Uid=my
21、Username;&_Pwd=myPassword;For more information,see:SybaseSystem 10 ODBC Driver ReferenceGuideODBC Driver for SybaseSQL AnywhereoConn.Open ODBC;Driver=Sybase SQL Anywhere 5.0;&_名师资料总结-精品资料欢迎下载-名师精心整理-第 6 页,共 21 页 -DefaultDir=c:dbpath;&_Dbf=c:sqlany50mydb.db;&_Uid=myUsername;&_Pwd=myPassword;Dsn=;Note
22、:Including the DSN tag with a null string is absolutely critical or else you get the dreaded-7778 error.For more information,see:SybaseSQL Anywhere User GuideODBC Driver for TeradataoConn.Open Provider=Teradata;&_DBCName=MyDbcName;&_Database=MyDatabaseName;&_Uid=myUsername;&_Pwd=myPassword;For more
23、information,seeTeradataODBC DriverODBC Driver for TextoConn.Open Driver=MicrosoftText Driver(*.txt;*.csv);&_Dbq=c:somepath;&_Extensions=asc,csv,tab,txt;&_Persist Security Info=FalseNote:Specify the filename in the SQL statement.For example:oRs.Open Select*From customer.csv,_oConn,adOpenStatic,adLock
24、ReadOnly,adCmdTextFor more information,see:Text File Driver Programming ConsiderationsODBC Driver for Visual FoxProWith a databasecontainer:oConn.Open Driver=MicrosoftVisual FoxPro Driver;&_SourceType=DBC;&_SourceDB=c:somepathmySourceDb.dbc;&_Exclusive=No;名师资料总结-精品资料欢迎下载-名师精心整理-第 7 页,共 21 页 -Without
25、 a databasecontainer(Free Table Directory):oConn.Open Driver=MicrosoftVisual FoxPro Driver;&_SourceType=DBF;&_SourceDB=c:somepathmySourceDbFolder;&_Exclusive=No;For more information,see:Visual FoxPro ODBC Driver and Q165492OLE DB Data Link ConnectionsData Link File(UDL)For Absolute Path:oConn.Open F
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年ADO连接字符串大全归 2022 ADO 连接 字符串 大全

限制150内