'修改页面
<%
strID = Request("tID")
set conn = Server.CreateObject("ADODB.Connection")
conn.Open("driver={SQL Server};database=pubs;server=(LOCAL);uid=sa;pwd=111111")
strSQL = "select * from txl Where tID ="&strID
set rs = conn.Execute(strSQL)
%>
<form name="form1" method="post" action="modifySumit.asp">
<% '输出表的内容
If not rs.EOF Then
%>
<table align="center" width="361" border="0"style="color:#3E96A6 ">
<tr>
<td align="center" bgcolor="#3E96A6"><span class="style11"><%=rs("tName")%>的通讯录</span></td>
</tr>
</table>
<table width="361" border="0" align="center" cellpadding="1">
<tr>
<td width="132"> </td>
<td width="219"><input type="hidden" name="tID" value="<%=rs("tID")%>"></td>
</tr>
<tr>
<td><span class="style7">EMAIL:</span></td>
<td><input name="tEmail" type="text" size="30" value="<%=rs("tEmail")%>"></td>
</tr>
<tr>
<td><span class="style7">手机号码:</span></td>
<td><input name="tMobile" type="text" size="30"value="<%=rs("tMobile")%>"></td>
</tr>
<tr>
<td><span class="style7">固定电话:</span></td>
<td><input name="tHomePhone" type="text" size="30"value="<%=rs("tHomePhone")%>"></td>
</tr>
<tr>
<td align="left" valign="top"><p class="style7">QQ:</p></td>
<td><input name="tQQ" type="text" size="30"value="<%=rs("tQQ")%>"></td>
</tr>
<tr>
<td align="left" valign="top"><span class="style7">备注:</span></td>
<td><span class="style7">
<textarea name="tMemo" cols="29" rows="3"><%=rs("tMemo")%></textarea>
</span></td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td><span class="style7">
<input type="submit" name="Submit" value="修改完毕">
</span></td>
</tr>
</table>
<%
End If
%>
</form>
修改后处理页面:
<%
tID = TRIM( REQUEST("tID"))
tEmail = TRIM( REQUEST("tEmail"))
tMobile = TRIM( REQUEST("tMobile"))
tHomePhone = TRIM( REQUEST("tHomePhone"))
tQQ = TRIM( REQUEST("tQQ"))
tMemo = TRIM( REQUEST("tMemo"))
set conn = Server.CreateObject("ADODB.Connection")
conn.Open("driver={SQL Server};database=pubs;server=127.0.0.1;uid=sa;pwd=111111")
set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = conn
SQL = "UPDATE txl SET tEmail='"&tEmail&"',tMobile='"&tMobile&"',tHomePhone='"&tHomePhone&"',tQQ='"&tQQ&"',tMemo='"&tMemo&"' Where tID="&tID
Response.Write(SQL)
cmd.CommandText = SQL
cmd.Execute()
Response.Redirect("index.asp")
%>
据说用IF ...ELSE.....THEN ....语句可以将此两个程序写在一起,敬请指点!!!
[此贴子已经被作者于2006-11-2 22:08:46编辑过]