Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
Query-based update failed because the row to update could not be found.
/editwritecus.asp, line 17
ด้านล่างเป็นตัวอย่าง Code นะครับ
Code (ASP)
<%
idcus=request.Form("idcus")
fname=request.Form("fname")
lname=request.Form("lname")
bdate=request.Form("bdate")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=sellshirt;UID=root;PWD=;OPTION=3"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "select * from customer where idcus ='"+request("idcus")+"' ;" , conn,1,3
rs("idcus")=idcus
rs("fname")=fname
rs("lname")=lname
rs("bdate")=bdate
rs.update
response.redirect("showcus.asp")
%>
จาก error คือมันไม่พบ Record ครับ มัน where ไม่เจอตั้งแต่แรกครับ
Date :
2012-03-16 14:48:23
By :
webmaster
No. 2
Guest
ใส่ If เพิ่มเข้าไป
Code (ASP)
idcus=request.Form("idcus")
fname=request.Form("fname")
lname=request.Form("lname")
bdate=request.Form("bdate")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=sellshirt;UID=root;PWD=;OPTION=3"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "select * from customer where idcus ='"+request("idcus")+"' ;" , conn,1,3
if not(rs.bof and rs.eof) then
rs("idcus")=idcus
rs("fname")=fname
rs("lname")=lname
rs("bdate")=bdate
rs.update
response.redirect("showcus.asp")
else
response.write "Not Found Data"
end if