还是数据连接的问题!!!!!!!!!!郁闷ing!!!!!!!!!!!!!!!!!!

Cuilian521 2004-04-08 02:57:53
我的系统是server,数据库是Sql Server2000,连接本地数据库出现错误,新建个工程把代码考过去就可以,这是为什么??(没有舍数据源)
<%@ Language = "VBScript" %>

<%

Dim strName,strCompany,strlink,strTitle,strQuestion

strTitle = Request.Form("textfield4")
strTitle = Trim(strTitle)
strTitle = replace(strTitle,"'","''")

strTitle = server.HTMLEncode(strTitle)


strQuestion = Request.Form("textfield4")
strQuestion = replace(strQuestion,"'","''")


strQuestion = replace(strQuestion,"<","<")
strQuestion = replace(strQuestion,">",">")


strName = Request.Form("textfield")
strCompany = Request.Form("textfield2")
strlink = Request.Form("textfield3")




set conn=server.createobject("adodb.connection")
Connstr="Provider=SQLOLEDB;Data Source=hf;UID=sa;PWD=sa;DataBase=BCAWeb"
conn.open connstr


set rec=server.createobject("adodb.recordset")
rec.open "select * from BCAWeb_Question where id is null",connstr,1,3
rec.AddNew
rec("name") = strname
rec("Companyname") = strCompany
rec("LinkWay") = strLink
rec("Title") = strTitle
rec("memo") = strQuestion
rec.Update

rec.Close

set rec = nothing
conn.Close
set conn = nothing

response.redirect "level3.htm"
%>

各位帮帮忙!! 帮我改改上面的!!!!分不多,就剩这些了!!谢谢!!

...全文
70 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
mrwang2000 2004-04-08
  • 打赏
  • 举报
回复
你先创建一个记事本文件(空的)然后修改它的扩展名为*.udl,
这时,这个文件的图标变了
你双击打开这个文件
按照弹出的窗口的要求,填写要连接的数据库,并测试连接
连接成功后
用记事本打开这个udl文件,把里边的字符串拷贝出来,作为你的连接字符串
再调适你的程序
应该就不会有问题了
chasesunman 2004-04-08
  • 打赏
  • 举报
回复
set conn = server.createobject("ADODB.Connection")
conn.open "DRIVER={sql server};database=BCAWeb;server=127.0.0.1;uid=sa;pwd=sa"
Cuilian521 2004-04-08
  • 打赏
  • 举报
回复
????????各位帮帮忙!!!在线一天了!~!
Cuilian521 2004-04-08
  • 打赏
  • 举报
回复
为什么一样的连接代码,连接两个不同的数据库,一个好使,一个不好使,
Microsoft ole db privider for sql server 的错误
Cuilian521 2004-04-08
  • 打赏
  • 举报
回复
to 嘉儿:hf 就是我得计算机名, 还是不行
是Microsoft ole db privider 的错误!!!
mary0226 2004-04-08
  • 打赏
  • 举报
回复
Data Source=hf这儿有错--------datasource=local或者是你的计算机名
conn.open connstr--------conn.open
rec.open "select * from BCAWeb_Question where id is null",connstr,1,3
----
rec.open "select * from BCAWeb_Question ",connstr,1,3
id 可以在数据库里面(id int primary key identity)

28,409

社区成员

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

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