|
|
|
ASP ช่วยดูโค้ดให้หน่อยครับว่าทำไมถึงไม่สามารถ Update ข้อมูลได้ครับ |
|
|
|
|
|
|
|
ไฟล์ Edit
Code (ASP)
<form action="Tire_SaveUpdateTire.asp?CusID=<%=Request.QueryString("TireNumber")%>" name="frmEdit" method="post">
<%
Dim Conn,strSQL,objRec,strSQL1,objRec1,Conn1
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "Driver={SQL Server};Server=L0820_WUTTISAA1;Database=OVCM;UID=ovcm;PWD=Ninekao9;"
strSQL = "SELECT * FROM FTire "
strSQL = strSQL & "WHERE TireNumber LIKE '%"&Request.QueryString("CusID")&"%' "
Set objRec = Conn.Execute(strSQL)
If objRec.EOF Then
Response.write("Not found CustomerID="&Request.QueryString("CusID"))
Else
%>
<table width="830" align="center">
<tr>
<td align="center"><h2>Installation of tires to the vehicle</h2></td>
</tr>
</table>
<table width="830" align="center">
<tr>
<td width="132" rowspan="4" align="right"><img src="images/images (9).jpg" width="90" height="90" /></td>
<td > Installation Date: </td>
<td colspan="2" ><input type="date" name="bday" /></td>
<td colspan="2"> </td>
</tr>
<tr>
<td > Tire No. : </td>
<td colspan="2" ><input name="txtTireNo" type="text" disabled="disabled" value="<%=objRec.Fields("TireNumber")%>" size="10" />
<input name="txtTireNo" type="hidden" value="<%=objRec.Fields("TireNumber")%>" /></td>
<td colspan="2"> JayaMix No. :
<input name="txtJayaMixNo" type="text" disabled="disabled" value="<%=objRec.Fields("JayaMixNumber")%>" size="10" />
<input name="txtJayaMixNo" type="hidden" value="<%=objRec.Fields("JayaMixNumber")%>" />
</td>
</tr>
<tr>
<td> Plate Number : </td>
<td colspan="2"><select name="txtTruckPlate">
<option value=""><-- Please Select Truck Plate --></option>
<%
strSQL = "SELECT * FROM FTruckProfile order by Plant,PlateNumber"
Set objRec = Server.CreateObject("ADODB.Recordset")
objRec.Open strSQL, Conn, 1,3
While Not objRec.EOF
%>
<option value="<%=objRec.Fields("PlateNumber").Value%>"><%=objRec.Fields("PlateNumber").Value & " - " & objRec.Fields("Plant").Value%></option>
<%objRec.MoveNext
Wend
%>
</select></td>
<td colspan="2"> Position of Tire :
<select name="txtPosition" >
<option value=""><-- Please Select Position --></option>
<option value="R01">R01</option>
<option value="L02">L02</option>
<option value="R03">R03</option>
<option value="L04">L04</option>
<option value="R05">R05</option>
<option value="L06">L06</option>
<option value="R07">R07</option>
<option value="L08">L08</option>
<option value="R09">R09</option>
<option value="L10">L10</option>
</select> </td>
</tr>
<tr>
<td width="105" align="center"> </td>
<td width="191"> </td>
<td width="48" align="center" > </td>
<td width="144"> </td>
<td width="182"> </td>
</tr>
</table>
<table width="830" border="0" align="center">
<tr>
<th scope="col" align="center"><input type="image" src="images/submit.gif" value="submit"></th>
</tr>
</table>
<%
End IF
objRec.Close()
Conn.Close()
Set objRec = Nothing
Set Conn = Nothing
%>
</form>
ไฟล์ Save
Code (ASP)
<%
Dim Conn,strSQL,objExec
Docdate = request.form("bday")
TireNo = Request.Form("txtTireNo")
JayaMixNo = Request.Form("txtJayaMixNo")
TruckPlate = Request.Form("txtTruckPlate")
Position = Request.Form("txtPosition")
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "Driver={SQL Server};Server=L0820_WUTTISAA1;Database=OVCM;UID=ovcm;PWD=Ninekao9;"
strSQL = "UPDATE FTire SET "
strSQL = strSQL &"InstallDate= '"&Docdate&"',PlateNumber='"&TruckPlate&"',"
strSQL = strSQL &"PositionTire='"&Position&"' "
strSQL = strSQL &"where TireNumber= '"&TireNo&"' "
Set objExec = Conn.Execute(strSQL)
If Err.Number = 0 Then
%>
<meta http-equiv="refresh" content="3;URL=Truck_SearchInstallationTire.asp">
<div align="center"></div>
<table width="75%" border="0" align="center">
<tr >
<td><div align="center">
<p>Save Comple </p>
</div></td>
</tr>
</table>
<div align="center"></div>
<table width="488" border="0" align="center">
<tr >
<td width="41%"><div align="center">Please wait or click</div></td>
<td width="16%"><div align="center"><a href="Truck_SearchInstallationTire.asp"><img src="images/button_blue_repeat.png" width="70" height="70" /></a></div></td>
<td width="43%">
<div align="center">For add New Tire</div>
</td>
</tr>
</table></th>
</tr>
</table>
<%
'Response.write("Save Done.")
Else
Response.write("Error Save ["&strSQL&"] ("&Err.Description&")")
End If
Conn.Close()
Set objExec = Nothing
Set Conn = Nothing
%>
Tag : ASP, MySQL, Windows
|
|
|
|
|
|
Date :
2015-05-13 14:47:14 |
By :
ninenine |
View :
1425 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (ASP)
Response.write strSQL
Set objExec = Conn.Execute(strSQL)
Response.write Err.Description
ผมว่ดู SQL และ Error Description ก็น่าจะได้คำตอบครับ
|
|
|
|
|
Date :
2015-05-13 17:05:50 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|