如何实现ASP和SQL SERVER 2000的数据库的连接

luyuly_222 2002-08-14 03:05:55
问题,都在标题里了,请回复的时候,能够举个完整的例子说明。记得附上源代码。
...全文
105 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
yhncom_36de 2002-08-14
  • 打赏
  • 举报
回复

<%
set con=server.createobject("ADODB.connection")
con.open "PROVIDER=SQLOLEDb;Persist Security Info=false;User id=sa;password=password;" & "Initial Catalog=job;DATA SOURCE=local"
%>
luoruanti 2002-08-14
  • 打赏
  • 举报
回复
同意楼上的,用odbc程序对于初学者是最简单明了的了
tripofdream 2002-08-14
  • 打赏
  • 举报
回复
0x80040E4D是验证失败,确认:
1.SQL Server使用Windows和SQL Server混合验证
2.luyuly_222密码正确且对要访问的数据库有足够的权限
cat_hsfz 2002-08-14
  • 打赏
  • 举报
回复
一个最简单的方法,先在你的电脑上安装sql server的odbc驱动程序(安装sql desktop版或者去down专门的都行),然后就在odbc(就在管理工具)里面新建一个file dsn连接你的sql server中的talbe(有向导的),之后就

strDSN="FILEDSN=dsnname"
cn.open strDSN
你就获得了打开了sql的connection,我想只要有了connection,接下来你就可以按你喜欢的做了吧。
gopark 2002-08-14
  • 打赏
  • 举报
回复

ConnStr = "Provider=SQLOLEDB.1;database=message;data source=127.0.0.1;User ID=luyuly_222;Password=bcl;Initial Catalog=message"
改为
ConnStr= "Driver={SQL Server};Server=127.0.0.1;UID=luyuly_222;PWD=bcl;Database=message;"
luyuly_222 2002-08-14
  • 打赏
  • 举报
回复
happynet(快乐数据) 用了你的程序,出现以下结果。何解?
错误类型:
Microsoft OLE DB Provider for SQL Server (0x80040E4D)
/test/a.asp, 第 12 行

修改后的源码为:
<%
DIM ObjConn
DIM StrConn
'On Error Resume Next
Set ObjConn =Server.CreateObject("ADODB.Connection")
ConnStr = "Provider=SQLOLEDB.1;database=message;data source=127.0.0.1;User ID=luyuly_222;Password=bcl;Initial Catalog=message"
if err then
err.clear
ObjConn.close
set ObjConn=nothing
else
ObjConn.open connstr
if err then
err.clear
ObjConn.close()
set ObjConn =nothing
response.write "open database is error<br>error id is "&err
response.end
end if
end if
%>

happynet 2002-08-14
  • 打赏
  • 举报
回复
<%
DIM ObjConn
DIM StrConn
'On Error Resume Next
Set ObjConn =Server.CreateObject("ADODB.Connection")
ConnStr = "Provider=SQLOLEDB.1;Data Source=主机IP;User ID=sa;Password=;Initial Catalog=数据库名"
if err then
err.clear
ObjConn.close
set ObjConn=nothing
else
ObjConn.open connstr
if err then
err.clear
ObjConn.close()
set ObjConn =nothing
response.write "open database is error<br>error id is "&err
response.end
end if
end if
%>
这是完整的
fbj007 2002-08-14
  • 打赏
  • 举报
回复
strconn = "Driver={SQL Server};Description=sqldemo;SERVER=127.0.0.1;UID=LoginID;PWD=Password; DATABASE=Database_Name"
set conn = server.createobject("adodb.connection")
conn.open strconn

不知这是否是你所要

28,408

社区成员

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

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