当前位置: 代码迷 >> ASP >> 缺少对象conn:求
  详细解决方案

缺少对象conn:求

热度:148   发布时间:2012-06-05 13:54:06.0
缺少对象conn:求高手指点
连接文件conn.asp:<%
dim conn
dim connstr

function openDB
dim db
db="../database/hotDB.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
conn.Open connstr
end function

function closeDB
conn.close
set conn=nothing
end function
%>







新闻编辑页面:
<!--#include file="include/conn.inc"-->
<%
if session("admin_name")="" then
  response.redirect "index.asp"
end if
openDB 
%>
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK rel="stylesheet" type="text/css" href="../style.css">
</HEAD>
<script LANGUAGE="JavaScript">
function check()
{
 if (document.form1.title.value=="")
  {
  alert("请输入新闻标题!")
  document.form1.title.focus()
  document.form1.title.select()
  return
  }
  document.form1.submit()
}
</script>
<%
set rs1=server.createobject("adodb.recordset")
Sql1="select * from webInfo where newsid="&request("newsid")&"" 
rs1.open sql1,conn,1,3
%>
<SCRIPT language=javascript>
  var upfile_obj;
  function OnUpFile()
  {
  upfile_obj.src=upfile_obj.lowsrc;
  upfile_obj.src=document.forms["form1"].upfile.value;
  }
</SCRIPT>
<FORM method="post" Action="SaveEdit.asp" Name="form1">
<input type="hidden" name="newsid" value="<%=request("newsid")%>">
<INPUT name=upfile onchange=return(OnUpFile()) type=hidden>
<CENTER>
  <TABLE width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#336699">
  <TR> 
  <TD height=30 colspan=2 background="../images/pics/tile_sub.gif"><b><font color="#FFFFFF">修改</font></b></TD>
  </TR>
  <TR bgcolor="#FFFFFF"> 
  <TD width="17%">信息标题:</TD>
  <TD width="60%"> 
  <input type="text" name="title" size="52" value="<%=rs1("title")%>"><font color=#ff6600> *</font></TD>
  </TR>
  <TR bgcolor="#FFFFFF"> 
  <TD>信息分类:</td>
  <TD> 
  <select name="typeid">
  <%
  set rstype=server.createobject("adodb.recordset")
  sqltype="select * from infoType"
  rstype.open sqltype,conn,1,1
  do while not rstype.eof
  if rs1("typeid")=rstype("typeid") then
  sel="selected"
  else
  sel=""
  end if
  response.write "<option " & sel & " value='"+CStr(rstype("typeID"))+"' name=typeid>"+rstype("type")+"</option>"+chr(13)+chr(10)
  rstype.movenext
  loop
  rstype.close
  %> 
  </select>
  </TD>
  </TR>
  <TR bgcolor="#FFFFFF"> 
  相关解决方案