回 帖 发 新 帖 刷新版面

主题:奇怪网页中为什么看不到连接数据库的代码

最近做了个网站,想在其中插入供求发不系统,所以在网上下载了中国山药网供求信息发布程序 v1.01。但想改一下数据库,在信息发布页面addmesg.asp上。看不出输入数据库的路径。请高手指点
页面代码如下
session("ad")=0%>
 <!--#include file="top.htm"--> 

<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>
<style>
<!--
td { font-size: 9pt }
 A:link {text-decoration: none; color:#000000}
 A:visited {text-decoration: none; color: #000000}
 A:active {text-decoration: none; color: #FF0000}
 A:hover {text-decoration: underline; color: FF0000}
-->
</style>

<div align="center">
 <center>
 <table width="762" border="0" cellpadding="2" cellspacing="2" bgcolor="#FFFFFF">
 <tr> 
 <td width="540" bgcolor="#FFFBEE">
<table width="520" border="0" align="center">
 <tr>
 <td> </td>
 </tr>
 <tr> 
 <td width="100%" class=f14 ><strong><font color="#FF6600">·发布信息</font></strong></td>
 </tr>
 <tr> 
 <td width="100%"> <p><font color="#FF0000"> <font color="#0000FF"> 
       注意:以下各项都必须填写</font><br>
       
 <%if request("w")=1 then response.write "请选择供求!"
 if request("w")=2 then response.write "主题不能为空!"
 if request("w")=3 then response.write "联系人不能为空!" 
 if request("w")=4 then response.write "联系电话不能为空!" 
 if request("w")=5 then response.write "内容不能为空!" 
 if request("w")=6 then response.write "内容超过100000个字母!"%>
 </font></p>
 <form method="POST" action="addmed.asp">
 <table width="450" border="0" align="center" cellpadding="1" cellspacing="2">
 <tr>
 <td>选择分类:</td>
 <td><select size="1" name="n" style="background-color: #FFFFE6">
 <option value="1">招商投资</option>
 <option value="2">生活服务</option>
 <option value="3">家电产品</option>
 <option value="4">旅游出行</option>
 <option value="5">招聘求职</option>
 <option value="6">房产家居</option>
 <option value="29">建材装饰</option>
 <option value="34">烟酒副食</option>
 <option value="7">电脑网络</option>
 <option value="8">餐饮酒店</option>
 <option value="9">医药保健</option>
 </select>      选择供求: 
    
    作者: 晓晓来了  2007-12-1 23:54   回复此发言  
    
3     回复:菜鸟请教高手帮忙,关于输入数据库的问题
    
 <input name="gq" type="radio" value="供" checked>
 供 
 <input type="radio" name="gq" value="求">
 求</td>
 </tr>
 <tr>
 <td width="16%">主    题:</td>
 <td width="84%">
 <!--webbot
 bot="Validation" B-Value-Required="TRUE"
 I-Maximum-Length="40" -->
 <input type="text" name="t1" size="44" maxlength="40"></td>
 </tr>
 <tr>
 <td width="16%">电子邮件:</td>
 <td width="84%">
 <!--webbot
 bot="Validation" B-Value-Required="TRUE"
 I-Maximum-Length="30" -->
 <input type="text" name="t2" size="44" maxlength="30"></td>
 </tr>
 <tr>
 <td width="16%">联 系 人:</td>
 <td width="84%" height="22">
 <!--webbot
 bot="Validation" B-Value-Required="TRUE"
 I-Maximum-Length="30" -->
 <input name="t5" type="text" id="t5" size="10" maxlength="30">
     联系电话: 
 <input type="text" name="t4" size="19" maxlength="30"></td>
 </tr>
 <tr>
 <td width="16%" valign="top">内    容:</td>
 <td width="84%" valign="middle">
 <textarea rows="6" name="t3" cols="43"></textarea></td>
 </tr>
 <tr>
 <td width="16%">所在地区:</td>
 <td width="84%">
<select name="d1" size="1">
 <option value="大同市">大同市</option>
 <option value="北京" selected>北京</option>
 <option value="上海">上海</option>
 <option value="天津">天津</option>
 <option value="重庆">重庆</option>
 <option value="广东">广东</option>
 <option value="河北">河北</option>
 <option value="山西">山西</option>
 <option value="内蒙">内蒙</option>
 <option value="辽宁">辽宁</option>
 <option value="吉林">吉林</option>
 <option value="黑龙江">黑龙江</option>
 <option value="江苏">江苏</option>
 <option value="浙江">浙江</option>
 <option value="安徽">安徽</option>
 <option value="福建">福建</option>
 <option value="江西">江西</option>
 <option value="山东">山东</option>
 <option value="河南">河南</option>
 <option value="湖北">湖北</option>
 <option value="湖南">湖南</option>
 <option value="广东">广东</option>
 <option value="广西">广西</option>
 </select>       有效期限: 
 <select size="1" name="d2">
 <option value="1">1天</option>
 <option value="30" selected>1个月</option>
 <option value="90">1个季度</option>
 <option value="182">半年</option>
 <option value="365">1年</option>
 </select></td>
 </tr>
 <tr>
 <td></td>
 <td></td>
 </tr>
 <tr>
 <td width="16%" align="center"> </td>
 <td width="84%" align="center"><input type="submit" value=" 马上发布" name="B1" style="background-color: #FFFFE6; font-size: 9pt; border -style: solid; border-color: #000000"> 
       <input type="reset" value="全部重填" name="B2" style= "background-color: #FFFFE6; font-size: 9pt; border-style: solid; border-color: #000000">
      </td>
 </tr>
 </table>
 </form>
 <p></p></td>
 </tr>
 </table> 
 </td>
 <td width="209" valign="top" bgcolor="#FEEFBC"> <table width="96%" border="0" align="center" cellspacing="0">
 <tr> 
 <td width="100%"></td>
 </tr>
 <tr> 
 <td height="20"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr> 
 <td width="8%"><img src="images/in4_08.gif" width="11" height="11"></td>
 <td width="92%" class=f14 ><font color="#FF3300"><strong>信息搜索</strong></font></td>
 </tr>
 </table></td>

回复列表 (共5个回复)

沙发


<!-- #include file="conn.asp" -->

看看像这样的包含文件中有没有?

板凳


先谢谢您。您说的那一条好像没有,只有<form method="POST" action="addmed.asp">
而addmed.asp中
<%if trim(request("gq"))="" then response.redirect "addmesg.asp?w=1&adwh=" &request("n")
if trim(request("t1"))="" then response.redirect "addmesg.asp?w=2&adwh=" &request("n")
if trim(request("t5"))="" then response.redirect "addmesg.asp?w=3&adwh=" &request("n")
if trim(request("t4"))="" then response.redirect "addmesg.asp?w=4&adwh=" &request("n")
if trim(request("t3"))="" then response.redirect "addmesg.asp?w=5&adwh=" &request("n")
if len(request("t3"))>1000 then response.redirect "addmesg.asp?w=6&adwh=" &request("n")
%>

第二条
<%set com=server.createobject("adodb.connection")
com.open "DBQ="& Server.MapPath("xinhs.mdb")  &";Driver={Microsoft Access Driver (*.mdb)};"

t1=replace(request("t1"),"<","〈")
t1=replace(t1,"'","''")
t2=replace(request("t2"),"<","〈")
t2=replace(t2,"'","‘’")
t4=replace(request("t4"),"<","〈")
t4=replace(t4,"'","‘’")
t5=replace(request("t5"),"<","〈")
t5=replace(t5,"'","‘’")
gq=replace(request("gq"),"<","〈")
gq=replace(gq,"'","‘’")
n=replace(request("n"),"<","〈")
n=replace(n,"'","‘’")
d1=replace(request("d1"),"<","〈")
d1=replace(d1,"'","''")
sz = "'" & t1 & "','" & t2 & "','" & t4 & "','" & t5 & "','" & gq & "','" & request("t3") & "','" & n &"','" & d1 &"','" & now & "',#" & dateadd("d",request("d2"),date) & "#"
if session("ad")=0 then com.Execute("INSERT INTO msg ( tit,mal,tel,lxr,gq,msg,kin,whe,tim,edt ) VALUES(" & sz & ")")
session("ad")=1%>
这两条代码是不是,其中msg表的名称 ( tit,mal,tel,lxr,gq,msg,kin,whe,tim,edt )表的项目,但是则么和输入的不对应

3 楼

<%set com=server.createobject("adodb.connection")
com.open "DBQ="& Server.MapPath("xinhs.mdb")  &";Driver={Microsoft Access Driver (*.mdb)};"
这个就是连接代码

4 楼

在请教一下,我如果在msg表的名称 ( tit,mal,tel,lxr,gq,msg,kin,whe,tim,edt )表的项目中,添加一项kin2代码该则么改

5 楼

谢谢问题已解决

我来回复

您尚未登录,请登录后再回复。点此登录或注册