老生长谈的问题。不好意思。还是要问问大家。关于数据库

troopers 2003-11-27 05:30:02
asp连sql server数据库 代码如下
<%
dim conn
set conn=server.createobject("ADODB.CONNECTION")
if err.number<>0 then
err.clear
set conn=nothing
Response.Write "数据库联接失败!"
Response.End
else
conn.open "web","",""
if err then
set conn=nothing
Response.Write "数据库联接失败!"
err.clear
Response.End
end if
end if
%>
sqlserver 用windows模式.设置好数据源为web。
为什么还是提示
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
/testsql.asp, 第 10 行
...全文
66 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
troopers 2003-11-28
  • 打赏
  • 举报
回复
换个表可以。我想问一下。用user当表的名称不行吗?
wlxz 2003-11-28
  • 打赏
  • 举报
回复
if not(rs.bof and eof) then
while not rs.eof
response.write""&rs("id")&"<br>"
rs.movenext
wend
else
response.write "没有数据"
end if
shleo 2003-11-28
  • 打赏
  • 举报
回复
asp不区分大小写的
换个table试一试
yeno 2003-11-28
  • 打赏
  • 举报
回复
用rs.open strsql,conn,1,1吧
troopers 2003-11-28
  • 打赏
  • 举报
回复
好象不区分大小写吧?
skyboy0720 2003-11-28
  • 打赏
  • 举报
回复
rs.open strSql,Conn,1,3

改为:

rs.open strSql,conn,1,3
troopers 2003-11-28
  • 打赏
  • 举报
回复
数据连接是搞定了。但是。为什么用下面语句测试连接的时候。又出现了问题。麻烦看看<%
connstr="provider=SQLOLEDB;Data Source =CELL-TROOPER;"&"database=SysPAS;user id=sa; password="
set conn=server.createobject("adodb.connection")
conn.open connstr
'下面是测试的语句。为什么加上后,就提示rs.open strSql,Conn,1,3那行有问题?
Set rs= Server.CreateObject("ADODB.Recordset")
strSql="select * from user"
rs.open strSql,Conn,1,3
while not rs.eof
response.write""&rs("id")&"<br>"
rs.movenext
wend
%>
jeffrywang 2003-11-27
  • 打赏
  • 举报
回复
sqlserver需要用户名和密码,虽然你是windows模式
lihua9666 2003-11-27
  • 打赏
  • 举报
回复
conn.open "web","",""
输入登录windows的用户名和密码试一下
tigerwen01 2003-11-27
  • 打赏
  • 举报
回复
设置为混合模式吧。

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧