SQL Server2000测试SQL语句的问题
<% set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ("driver={SQL Server};database=pubs; " &"server=local; uid=sa; pwd=163")
set rs=conn.execute("select * from titles")
for i=0 to rs.fields.count-1
response.Write(rs(i).name+"<br>")
next
%>
错误提示:[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server 不存在或访问被拒绝
我刚装好SQL,现在想连接pubs做一个测试,文件保存在IIS根目录下的,但运行不了
参考答案:少了个括号吧
<% set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ("driver={SQL Server};database=pubs; " &"server=(local); uid=sa; pwd=163")
set rs=conn.execute("select * from titles")
for i=0 to rs.fields.count-1
response.Write(rs(i).name+"<br>")
next
%>