ODBC文件DSN的结构

来源:互联网 发布:炒股软件指南针 编辑:程序博客网 时间:2024/06/05 21:49
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

                       ODBC文件DSN的小秘密
1.用附件带的WORDPAD文本编辑器, 建立一后缀名为.DSN文件, 格式如下,然后按文本格式存起来:
注意:格式很重要且必须存为'文本格式',否则不认, 别的编辑器应该也可以.
#################################
[ODBC]
DRIVER=驱动程序名
UID=用户名
PWD=密码
DATABASE=名
WSID=服务器名
APP=(随便填)
SERVER=服务器名
###############################

2.将此.DSN文件拷贝到你的COMMONFILES/ODBC/DataSources目录下,如果弄不清楚目录, 
到控制面板中试建一个文件DSN然后查找此文件就可得到目录.

3.用cn.open"FILEDSN=文件名.DSN" 就可连上了.

****************************************************************************
以下是本人的试验
1.My.DSN文件:
[ODBC]
DRIVER=
UID=sa
PWD=finegirl
DATABASE=TestDB
WSID=tbb-it
APP=NetstarApplication
SERVER=tbb-it

2.拷贝到C:/ProgramFiles/CommonFiles/ODBC/DataSources目录

3.程序中调用如下:
DimcnAsNewADODB.Connection
cn.Open"FILEDSN=My.DSN"
*****************************************************************************

够清楚吧,记得加分,如果你够英俊潇洒,请喝咖啡也可以.:)

我要回复:有人参与讨论这个问题,请用EMail通知我
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击