帮我看看错在哪里

lvconghua 2004-04-04 07:59:12
代码如下:

sub conn_open()
set conn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")connstr="Provider=SQLOLEDB.1;Persist Security Info=True;Data Source=local;Packet Size=4096;User Id=sa;PASSWORD=;Initial Catalog=joekoe_data;"
conn.open connstr
isconn=true
end sub

错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
/include/jk_class.asp, 第 22 行

22行也就是conn.open connstr
...全文
50 12 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
lvconghua 2004-04-06
  • 打赏
  • 举报
回复
数据库原来是ACCESS的,文件名叫joekoe_data.mdb。我导入到SQL2000中数据库名叫joekoe_data。
lvconghua 2004-04-06
  • 打赏
  • 举报
回复
不好意思,我搞错了代码如下:
function exec(esql,etype)
if isconn=false then call conn_open()
'response.write vbcrlf&"//<br>"&esql
select case etype
case 0
conn.execute(esql)
case 1
set exec=conn.execute(esql)
end select
num_rs=num_rs+1
end function
sub conn_open()
set conn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
connstr="Provider=SQLOLEDB;Data Source=dell;User Id=sa;PASSWORD=;Initial Catalog=joekoe_data;"
conn.open connstr
isconn=true
end sub


其它地方调用的话是这样的:
set rs=joekoe_cms.exec("select count(id) from shop_product where hidden=1",1)
if not rs.eof then num_product=rs(0)
rs.close

或者如:
if update_ok=true then
call joekoe_cms.exec("update "&data_name&" set m_order="&order2&" where m_id="&id1,0)
call joekoe_cms.exec("update "&data_name&" set m_order="&order1&" where m_id="&id2,0)
end if

错误提示:
Microsoft OLE DB Provider for SQL Server 错误 '80040e14'

Invalid parameter 1 specified for datediff.

/include/jk_class.asp,行22

第22行是: case 0下面的 conn.execute(esql)
zengh 2004-04-05
  • 打赏
  • 举报
回复
改为
connstr="provider=sqloledb;data source=local;initial catalog=;user id=sa;password="

  • 打赏
  • 举报
回复
用odbc的,
connstr="driver={SQL Server};server=localhost;uid=sa;pwd=XXX;DATABASE=databasename"

dw生成的连接代码很垃圾~
evice 2004-04-04
  • 打赏
  • 举报
回复
这样写更简单,不知行不行:
connstr="driver={SQL Server};server=localhost;uid=sa;pwd=XXX"
loveweb 2004-04-04
  • 打赏
  • 举报
回复
五星好漂亮
Drowning 2004-04-04
  • 打赏
  • 举报
回复
连的是SQL Server的数据库吗?
wanghr100 2004-04-04
  • 打赏
  • 举报
回复
Try..
"Provider=SQLOLEDB.1;Persist Security Info=True;Data Source=local;Packet Size=4096;User Id=sa;PASSWORD=;Initial Catalog=joekoe_data;"
->
"Provider=sqloledb;Data Source=local;Initial Catalog=joekoe_data;User Id=sa;Password=;"
孟子E章 2004-04-04
  • 打赏
  • 举报
回复
or
connstr="Provider=SQLOLEDB;Data Source=.;User Id=sa;PASSWORD=;Initial Catalog=joekoe_data;"
孟子E章 2004-04-04
  • 打赏
  • 举报
回复
or

connstr="Provider=SQLOLEDB.1;Data Source=.;User Id=sa;PASSWORD=;Initial Catalog=joekoe_data;"
孟子E章 2004-04-04
  • 打赏
  • 举报
回复
connstr="Provider=SQLOLEDB.1;Data Source=(local);User Id=sa;PASSWORD=;Initial Catalog=joekoe_data;"
cjf1009 2004-04-04
  • 打赏
  • 举报
回复
No.1顶

28,409

社区成员

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

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