搞不清了,请大家帮忙!

unique 2003-03-16 11:28:28
这段代码总是报错:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
Newsin.asp, 第 60 行


<%
' 文件名:Newsin.asp
' 功能:添加网站新闻
%>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<!--#include file="functions.asp" -->
<!--#include file="OpenDatabase.asp" -->

<%
response.buffer=true

if session("userid")="" then
response.redirect "../../../admin/login.asp?link=../xxpt/news/admin/Newsin.asp"
else
if instr(session("right"), "4")<=0 then '4是新闻管理的权限编号
Call print_header("网站新闻动态更新系统后台管理—添加新闻")
Call print_body("添 加 新 闻")
%>
<p align=center>抱歉,您没有添加新闻的权限!</p>
<%
Call print_end()
response.end
end if
end if

Call print_header("网站新闻动态更新系统后台管理—添加新闻")
Call print_body("添 加 新 闻")
%>
<Script language="JavaScript">
<!--
//校验表单合法性函数
function check_form(){
if (formNewsin.Title.value ==""){
alert("请填写新闻标题!");
formNewsin.Title.focus();
return false;
}
if (formNewsin.IndTypeId.value==""){
alert("请选择新闻所属行业类别!");
formNewsin.IndTypeId.focus();
return false;
}
if (formNewsin.imagefile.value!="" && (formNewsin.imagefile.value.search(".jpg")<1 && formNewsin.imagefile.value.search(".gif")<1 && formNewsin.imagefile.value.search(".jpeg")<1))
{
alert("您上传的新闻图片不是合法的图片格式,请重传!");
formNewsin.imagefile.focus();
return (false);
}
return true;
}
-->
</script>

<%
Dim strSQL, rsNews

If Request.QueryString("step")="add" then
' Set rsNews=Server.CreateObject("adodb.recordset")
strSQL="select * from news where title='" & Request.Form("title") & "' and industrytypeid='" & Request.Form("IndTypeId") &"'"
Set rsNews=Conn.Execute(strSQL)
If Not rsNews.EOF Then
%>
<p align='center'><font color='red'>对不起,同类别中已经有同标题的新闻了!</font></p>
<%
Else
strSQL="select max(newsid) as themax from news"
set rsMax=Conn.execute(strSQL)
if isnull(rsMax("themax")) then intMax=1 else intMax=rsMax("themax")+1

strSQL="insert into news (newsid, title, content, userid, industrytypeid, newsdate,isindex) values (" & intMax & ",'" & Request.Form("title") & "','" & Request.Form("content") & "',1," & Request.Form("IndTypeId") & ",'" & Cstr(Formatdatetime(date,1)) & "',1)"
Conn.Execute(strSQL)

%>
<p align='center'>新闻添加成功!</p>
<%
End If

set rsNews = nothing
End If
%>

<table border=0 width="100%" align=center>
<form ENCTYPE="multipart/form-data" action="Newsin.asp?step=add" name="formNewsin" method="post" onsubmit="return check_form()">
<tr>
<th width="24%" align="center">新闻标题:</th>
<th width="76%" align="left"><input type="text" name="Title" size="30" maxlength=100> * </th>
</tr>
<tr>
<th width="24%" align="center">新闻类别:</th>
<th width="76%" align="left">
<select size="1" name="IndTypeId">
<option value=""> ——未选择—— </option>
<%
strtype="select * from " & NewsTypeTable & " order by industrytypeid"
set rstype= Conn.Execute(strtype)
do while not rstype.EOF
%>
<option value=<%=rstype("industrytypeid")%>><%=rstype("industrytype")%>-<%=rstype("industrytypeid")%></option>
<%
rstype.movenext
loop
%>
</select> *
</th>
</tr>
<tr>
<th width="24%" align="center">位置:</th>
<th width="76%" align="left">
<select size="1" name="location">
<option value="0">左上</option>
<option value="1">右上</option>
</select>
</th>
</tr>
<tr>
<th width="24%" align="center">相关图片:</th>
<td width="76%"><input type="file" name="imagefile" size="20"> (图片尺寸尽量控制在130x180左右)</td>
</tr>
<tr><th colspan="2"> 新闻内容:</th></tr>
<tr>
<td colspan=2 align="center"><textarea name="content" cols=60 rows=10></textarea></td>
</tr>
<tr>
<td align="center" colspan=2> 注:带*号项必须填写 </td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" name="Submit" value="添加">
    
<input type="reset" name="Submit2" value="取消">
     <a href="default.asp">返回</a> </td>
</tr>
</form>
</table>
<%
'rstype.close
'set rstype = nothing

Call print_end
Conn.close
set Conn = nothing
%>
...全文
41 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
unique 2003-03-16
  • 打赏
  • 举报
回复
谢谢,那如何改呢?
孟子E章 2003-03-16
  • 打赏
  • 举报
回复
字段类型不匹配
unique 2003-03-16
  • 打赏
  • 举报
回复
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
同处报错
possible_Y 2003-03-16
  • 打赏
  • 举报
回复
错误有变化么?
unique 2003-03-16
  • 打赏
  • 举报
回复
还是不行!
possible_Y 2003-03-16
  • 打赏
  • 举报
回复
strSQL="select * from news where title='" & Request.Form("title") & "' and industrytypeid=" & Request.Form("IndTypeId")

28,391

社区成员

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

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