主题:ASP上传后不能使用问题,急求高手来解答
我原来的conn.asp文件(链接数据库的那个)传上去后,一直提示路径问题,找人把conn.asp文件的书写格式修改后,网页打开很卡,只能显示一部分,但是绑定数据库的地方还是打不开,提示IIS超时。
我把conn.asp和绑定数据库的源文件代码发出来,请高手帮我解决修改。帮我修改conn.asp的人说我源文件绑定数据库的地方也要修改,但我不会改,所以请高手帮忙!
conn.asp的代码:(帮我修改为server.path格式后的)
<%
dim conn,db
dim connstr
db="Data/home.asp"
on error resume next
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
if err then
err.clear
else
conn.open connstr
end if
sub CloseConn()
conn.close
set conn=nothing
end sub
%>
绑定数据库的地方:
(1)记录集
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn_STRING
Recordset1.Source = "SELECT * FROM type"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
(2)动态列表(绑定数据库的地方)
<select name="h_type" id="h_type">
<%
While (NOT Recordset1.EOF)
%><option value="<%=(Recordset1.Fields.Item("t_name").Value)%>" <%If (Not isNull((Recordset1.Fields.Item("t_name").Value))) Then If (CStr(Recordset1.Fields.Item("t_name").Value) = CStr((Recordset1.Fields.Item("t_name").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(Recordset1.Fields.Item("t_name").Value)%></option>
<%
Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
%>
</select>
(3)插入记录
<form id="form1" name="form1" method="POST" action="<%=MM_editAction%>">
<table width="315" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCFFCC">
<tr>
<th width="108" height="30" align="center" scope="col">入住</th>
<th width="207" align="left" scope="col"><input name="h_r" type="text" id="h_r" /></th>
</tr>
<tr>
<td height="30" align="center">离开</td>
<td align="left"><input name="h_l" type="text" id="h_l" /></td>
</tr>
<tr>
<td height="30" align="center">类型</td>
<td align="left"><select name="h_type" id="h_type">
<%
While (NOT Recordset1.EOF)
%><option value="<%=(Recordset1.Fields.Item("t_name").Value)%>" <%If (Not isNull((Recordset1.Fields.Item("t_name").Value))) Then If (CStr(Recordset1.Fields.Item("t_name").Value) = CStr((Recordset1.Fields.Item("t_name").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(Recordset1.Fields.Item("t_name").Value)%></option>
<%
Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
%>
</select>
</td>
</tr>
<tr>
<td height="30" align="center">姓名</td>
<td align="left"><input name="h_name" type="text" id="h_name" /></td>
</tr>
<tr>
<td height="30" align="center">电话</td>
<td align="left"><input name="h_tel" type="text" id="h_tel" /></td>
</tr>
<tr>
<td height="30" align="center">电邮</td>
<td align="left"><input name="h_email" type="text" id="h_email" /></td>
</tr>
<tr>
<td height="30" align="right"><input name="Submit" type="submit" onclick="MM_validateForm('h_r','','R','h_l','','R','h_name','','R','h_tel','','R','h_email','','RisEmail');MM_popupMsg('提交成功!');return document.MM_returnValue" value="提交" /></td>
<td align="center"><input type="reset" name="Submit2" value="重置" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
我把conn.asp和绑定数据库的源文件代码发出来,请高手帮我解决修改。帮我修改conn.asp的人说我源文件绑定数据库的地方也要修改,但我不会改,所以请高手帮忙!
conn.asp的代码:(帮我修改为server.path格式后的)
<%
dim conn,db
dim connstr
db="Data/home.asp"
on error resume next
connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
if err then
err.clear
else
conn.open connstr
end if
sub CloseConn()
conn.close
set conn=nothing
end sub
%>
绑定数据库的地方:
(1)记录集
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn_STRING
Recordset1.Source = "SELECT * FROM type"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
(2)动态列表(绑定数据库的地方)
<select name="h_type" id="h_type">
<%
While (NOT Recordset1.EOF)
%><option value="<%=(Recordset1.Fields.Item("t_name").Value)%>" <%If (Not isNull((Recordset1.Fields.Item("t_name").Value))) Then If (CStr(Recordset1.Fields.Item("t_name").Value) = CStr((Recordset1.Fields.Item("t_name").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(Recordset1.Fields.Item("t_name").Value)%></option>
<%
Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
%>
</select>
(3)插入记录
<form id="form1" name="form1" method="POST" action="<%=MM_editAction%>">
<table width="315" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCFFCC">
<tr>
<th width="108" height="30" align="center" scope="col">入住</th>
<th width="207" align="left" scope="col"><input name="h_r" type="text" id="h_r" /></th>
</tr>
<tr>
<td height="30" align="center">离开</td>
<td align="left"><input name="h_l" type="text" id="h_l" /></td>
</tr>
<tr>
<td height="30" align="center">类型</td>
<td align="left"><select name="h_type" id="h_type">
<%
While (NOT Recordset1.EOF)
%><option value="<%=(Recordset1.Fields.Item("t_name").Value)%>" <%If (Not isNull((Recordset1.Fields.Item("t_name").Value))) Then If (CStr(Recordset1.Fields.Item("t_name").Value) = CStr((Recordset1.Fields.Item("t_name").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(Recordset1.Fields.Item("t_name").Value)%></option>
<%
Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
%>
</select>
</td>
</tr>
<tr>
<td height="30" align="center">姓名</td>
<td align="left"><input name="h_name" type="text" id="h_name" /></td>
</tr>
<tr>
<td height="30" align="center">电话</td>
<td align="left"><input name="h_tel" type="text" id="h_tel" /></td>
</tr>
<tr>
<td height="30" align="center">电邮</td>
<td align="left"><input name="h_email" type="text" id="h_email" /></td>
</tr>
<tr>
<td height="30" align="right"><input name="Submit" type="submit" onclick="MM_validateForm('h_r','','R','h_l','','R','h_name','','R','h_tel','','R','h_email','','RisEmail');MM_popupMsg('提交成功!');return document.MM_returnValue" value="提交" /></td>
<td align="center"><input type="reset" name="Submit2" value="重置" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>