|
|
|
ส่งค่าจากหน้า Edit ไปหน้า save ไม่ได้แต่กด save ขึ้นว่าสำเร็จ |
|
|
|
|
|
|
|
หน้าEdit
Code (ASP)
<% Option Explicit %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<html>
</script>
<style type="text/css">
<!--
.style6 { color: #FFFFFF;
font-weight: bold;
}
.style8 {color: #0077A5;
font-size: 12px;
}
.style9 {font-size: 14px}
-->
</style>
<head>
<title>Edit data Cisco</title>
</head>
<body>
<form action="CiscoEditRecordSave.asp?CusID1=<%=Request.QueryString("IP")%>&CusID2=<%=Request.QueryString("Port")%>" name="frmEdit" method="post">
<%
Dim Conn,strSQL,objRec
Response.write("Not found ID="&Request.QueryString("CusID1"))
Response.write("Not found ID="&Request.QueryString("CusID2"))
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase.mdb"),"" , ""
strSQL = "SELECT a.IP,b.Equipment_Name,a.Version,a.SwImage,a.Port,a.Status,a.Description FROM MyTable as a INNER JOIN Table1 as b on a.IP = b.IP "
strSQL = strSQL & "where (a.IP= '"&Request.QueryString("CusID1")&"' and a.Port= '"&Request.QueryString("CusID2")&"' )"
Set objRec = Conn.Execute(strSQL)
If objRec.EOF Then
Response.write("Not found ID="&Request.QueryString("CusID1"))
Response.write("Not found ID="&Request.QueryString("CusID2"))
Else
%>
[font=Verdana]<center>แก้ไขข้อมูล</center>[/size]
<table width="1300" border="1">
</tr>
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF" class="border style6 style9">
<th width="100" bordercolor="#FFFFFF" bgcolor="#0077A5"> <div align="center" >IP </div></th>
<th width="98" bordercolor="#FFFFFF" bgcolor="#0077A5"> <div align="center" >Equipment_Name </div></th>
<th width="200" bordercolor="#FFFFFF" bgcolor="#0077A5"> <div align="center" >Version </div></th>
<th width="320" bordercolor="#FFFFFF" bgcolor="#0077A5"> <div align="center" >Model </div></th>
<th width="100" bordercolor="#FFFFFF" bgcolor="#0077A5"> <div align="center" >Port </div></th>
<th width="180" bordercolor="#FFFFFF" bgcolor="#0077A5"> <div align="center" >Status </div></th>
<th width="500" bordercolor="#FFFFFF" bgcolor="#0077A5"> <div align="center" >Description </div></th>
</tr>
<tr>
<td><div align="center"><input type="text" name="txtIP" size="14" value="<%=objRec.Fields("IP")%>"></div></td>
<td><input type="text" name="txtEquipment_Name" size="20" value="<%=objRec.Fields("Equipment_Name")%>"></td>
<td><input type="text" name="txtVersion" size="25" value="<%=objRec.Fields("Version")%>"></td>
<td><div align="center"><input type="text" name="txtSwImage" size="25" value="<%=objRec.Fields("SwImage")%>"></div></td>
<td align="right"><input type="text" name="txtPort" size="15" value="<%=objRec.Fields("Port")%>"></td>
<td align="center"><input type="text" name="txtStatus" size="18" value="<%=objRec.Fields("Status")%>"></td>
<td align="center"><input type="text" name="txtDescription" size="50" value="<%=objRec.Fields("Description")%>"></td>
</tr>
</table>
<input type="submit" name="submit" value="submit">
<%
End IF
objRec.Close()
Conn.Close()
Set objRec = Nothing
Set Conn = Nothing
%>
</form>
</body>
</html>
หน้า save
Code (ASP)
<% Option Explicit %>
<html>
<head>
<title>Save Record Cisco</title>
</head>
<body>
<%
Response.write("Not found ID="&Request.QueryString("CusID1"))
Response.write("Not found ID="&Request.QueryString("CusID2"))
Dim Conn,strSQL,objExec,strSQL2,objExec2
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase.mdb"),"" , ""
strSQL = "UPDATE MyTable SET "
strSQL = strSQL&" IP = '"&Request.Form("txtIP")&"' "
strSQL = strSQL&",Version = '"&Request.Form("txtVersion")&"' "
strSQL = strSQL&",SwImage = '"&Request.Form("txtSwImage")&"' "
strSQL = strSQL&",Port = '"&Request.Form("txtPort")&"' "
strSQL = strSQL&",Status = '"&Request.Form("txtStatus")&"' "
strSQL = strSQL&",Description = '"&Request.Form("txtDescription")&"' "
strSQL = strSQL&" where (IP= '"&Request.QueryString("CusID1")&"' and Port= '"&Request.QueryString("CusID2")&"' )"
Set objExec = Conn.Execute(strSQL)
strSQL2 = "UPDATE Table1 SET "
strSQL2 = strSQL2&" IP = '"&Request.Form("txtIP")&"' "
strSQL2 = strSQL2&",Equipment_Name = '"&Request.Form("txtEquipment_Name")&"' "
strSQL2 = strSQL2&" where (IP= '"&Request.QueryString("CusID1")&"') "
Set objExec2 = Conn.Execute(strSQL2)
If Err.Number = 0 Then
Response.write("Save Done.")
Else
Response.write("Error Save ["&strSQL&"] ("&Err.Description&")")
End IF
Conn.Close()
Set objExec = Nothing
Set Conn = Nothing
%>
</body>
</html>
Tag : ASP
|
ประวัติการแก้ไข 2013-05-15 14:25:38
|
|
|
|
|
Date :
2013-05-15 14:24:31 |
By :
solskjaer16 |
View :
1124 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้ละคับปิดกระทู้
|
|
|
|
|
Date :
2013-05-15 14:42:42 |
By :
solskjaer16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|