主题:  初学ASP,希望大家帮帮忙.

freelyice

职务:普通成员
等级:1
金币:1.0
发贴:159
#12003/3/27 8:46:55
这是个很菜鸟的问题..
想使用odbc dsn与sqlserver进行连接,代码如下:



取出特定表的字段名称


<%
TableName = "通讯录"
Set OBJConn = Server.CreateObject("ADODB.Connection")
OBJConn.open "5460", "test" , "test1"
SQLstr = "Select * from " & TableName
On Error Resume Next
Set Rs = OBJConn.Execute(SQLstr)
Response.Write "表名:" & TableName & "
"
for I=0 to Rs.Fields.Count
    Response.write "字段名:" & Rs(I).Name & "
"
next
%>



____________________________________
test与test1是用了SQLSERVER登陆帐号与密码,
但运行后总是出现下列错误:
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
/study/odbc.asp, 第 10 行
_________________________
怎么办呀?真搞不懂...