ADO中,如何获得连接字符串?

Jans 2002-03-13 03:20:44
如:
Driver={Microsoft dBASE Driver (*.dbf)};DBQ; DriverID=533;
这些东西,怎么得到的,在那里能够拷贝?或者需用什么工具?
谢谢!
...全文
48 点赞 收藏 4
写回复
4 条回复
strip 2002年03月13日
你这个字符串是dns-less的ado连接字符串,这个不能通过什么build出来,只能自己write from scratch

你把我下面贴的东西全部保存下来吧:)
----------------------------------------------------------------
ODBC DNS-Less Connections
----------------------------------------------------------------
ODBC Driver for AS/400
Conn.Open "Driver={Client Access ODBC Driver (32-bit)};" & _
"System=myAS400;Uid=myUsername;Pwd=myPassword;"


ODBC Driver for dBASE
Conn.Open "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=\somepath;"
* ???????????????????? SQL
rs.Open "SELECT * FROM USER.DBF", Conn


ODBC Driver for MS Access
Conn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=\path\mydb.mdb;Uid=Admin;Pwd=;"

Using a Workgroup (System database)
Conn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=\path\mydb.mdb;SystemDB=\somepath\mydb.mdw;", "admin",""


ODBC Driver for MS Excel
Conn.Open "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;" & _
"Dbq=\somepath\Sheet1.xls;DefaultDir=\somepath;"


ODBC Driver for MySQL (MyODBC)
Conn.Open "Driver={mySQL};Server=MyServerName;Option=16834;Database=mydb;"

ODBC Driver for Oracle
Conn.Open "Driver={Microsoft ODBC for Oracle};Server=OracleServer.world;" & _
"Uid=myUsername;Pwd=myPassword;"


ODBC Driver for Paradox
Conn.Open "Driver={Microsoft Paradox Driver (*.db)};DriverID=538;Fil=Paradox 5.X;" & _
"DefaultDir=c:\dbpath\;Dbq=c:\dbpath\;CollatingSequence=ASCII;"


ODBC Driver for SQL Server
Conn.Open "Driver={SQL Server};Server=MyServerName;Database=myDatabaseName;" & _
"Uid=myUsername;Pwd=myPassword

For trusted connection
Conn.Open "Driver={SQL Server};Server=MyServerName;Database=myDatabaseName;" & _
"Trusted_Connection=yes;"

To Prompt user for username and password
Conn.Properties("Prompt") = adPromptAlways
Conn.Open "Driver={SQL Server}; Server=ServerName; DataBase=DatabaseName;"


ODBC Driver for Sybase
Sybase System 11 ODBC Driver
Conn.Open "Driver={SYBASE SYSTEM 11}; Srvr=myServerName;" & _
"Uid=myUsername; Pwd=myPassword;"

Intersolv 3.10 Sybase ODBC Driver
Conn.Open "Driver={INTERSOLV 3.10 32-BIT Sybase}; Srvr=myServerName;" & _
"Uid=myUsername; Pwd=myPassword;"


ODBC Driver for Sybase SQL Anywhere
Conn.Open "ODBC; Driver=Sybase SQL Anywhere 5.0;" & _
"DefaultDir=c:\dbpath\; Dbf=c:\sqlany50\mydb.db;" & _
"Uid=myUsername; Pwd=myPassword; Dsn="""";"


ODBC Driver for Text
Conn.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};" & _
"Dbq=\somepath\; Extensions=asc,csv,tab,txt; Persist Security Info=False"
* .....SQL
rs.Open "SELECT * FROM CUSTOMER.CSV", Conn


ODBC Driver for Visual FoxPro
With a database container
Conn.Open "Driver={Microsoft Visual FoxPro Driver}; SourceType=DBC;" & _
"SourceDB=\somepath\mySourceDb.dbc; Exclusive=No;"

Without a database container (Free Table Directory)
Conn.Open "Driver={Microsoft Visual FoxPro Driver}; SourceType=DBF;" & _
"SourceDB=\somepath\mySourceDbFolder; Exclusive=No;"


--------------------------------------------
如果不是dns-less的connection string, 可以

在桌面上生成test.txt文件,空的
然后改名为test.udl
然后双击test.udl
config完了之后
用ultraedit打开,拷贝里面的connection string 就可以了
回复 点赞
lz_fjh 2002年03月13日
在vb里新建一个新的工程,,选择新建窗体,选择vb数据向导生成一个数据窗体,其中就有,自己赵吧
回复 点赞
kingofhell 2002年03月13日
先用ado控键连接,而后报连接信息烤下来
回复 点赞
pfans 2002年03月13日
你可以先用ADODC控件,设置ADODC的连接字符串,然后再copy它即可.
回复 点赞
发动态
发帖子
VC/MFC
创建于2007-09-28

7901

社区成员

42.1w+

社区内容

VC/MFC相关问题讨论
社区公告
暂无公告