使用ADO连接到后的

<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>

1. 防火墙必须配置为允许1433端口为引入端口,以及1024-65535为外出端口

2. 连接字符串必须指定SQLServer地址:IP地址,服务器DNS名字或host文件里的名字

3. 连接字符串应当指定NetworkLibrary类型,在这种情况下"dbmssocn"(没有引号)为TCP/IPsNet-Library

在下面的例子代码中,servername应当为服务器DNS名字,IP地址,或hosts文件中的名字:

SetConn=CreateObject("ADODB.Connection")

SetRs=CreateObject("ADODB.Recordset")

SetCmd=Createobject("ADODB.Command")   

Conn.Open"Provider=SQLOLEDB;Password=password;PersistSecurityInfo=True;UserID=username;InitialCatalog=DBNAME;DataSource=servername;NetworkLibrary=dbmssocn"

Cmd.ActiveConnection=Conn

SQL="Select*fromTABLE"

Cmd.CommandText=SQL

SetRs=Cmd.Execute

<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>
阅读更多
个人分类: 数据库
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭