By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,659 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,659 IT Pros & Developers. It's quick & easy.

I have error of update code in asp program

P: 2
I have error in update code. It work but i not found data in Microsoft Access.
This is the code.
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body><br><br><br><br><br><br><br><br>
  3. <h1><center>Appointment Update
  4. <hr>
  5. <% 
  6. dim AppointmentID
  7. dim ChildID
  8. dim VisitID
  9. dim StaffID
  10. dim DateOfAppointment
  11. dim Time
  12. dim Remarks
  13. AppointmentID=request.form("AppointmentID")
  14. Response.write(AppointmentID)
  15. ChildID=request.form("ChildID")
  16. VisitID=request.form("VisitID")
  17. StaffID=request.form("StaffID")
  18. DateOfAppointment=request.form("DateOfAppointment")
  19. Time=request.form("Time")
  20. Remarks=request.form("Remarks")
  21. sql="update Appointment set ChildID='"&ChildID&"',VisitID='"&VisitID&"',StaffID='"&StaffID&"',DateOfAppointment='"&DateOfAppointment&"',Time='"&Time&"',Remarks='"&Remarks&"' where AppointmentID='"&AppointmentID&"'"
  22. //response.write sql
  23. set Conn=Server.CreateObject("ADODB.Connection")
  24. "C"
  25. set rs=Server.CreateObject("ADODB.recordset")
  26. response.write("update data")
  27. %>
  28. ID of child is Updated
  30. <form  method ="POST"action="medicals.asp">
  31. <input type=Submit value="Back">
  32. </form>
  33. </body>
  34. </html>
Please help me.
Dec 29 '10 #1
Share this Question
Share on Google+
3 Replies

Expert 2.5K+
P: 3,405
So this doesn't give an error? I can think of several reasons that it would fail to update, but they should all give an error.

Try outputting just your update statement (response.write sql) and run it in access's query analyzer? Does it work from there?

Dec 29 '10 #2

P: 2
Thanks for reply my message. I edit the code but I face new error. The error is Update Statement.
This is the code.
<h1><center>Appointment Update
dim AppointmentID
dim ChildID
dim VisitID
dim StaffID
dim DateOfAppointment
dim Time
dim Remarks
DateOfAppointment=request.form("DateOfAppointment" )
set conn=Server.CreateObject("ADODB.Connection")
set rs=Server.CreateObject("ADODB.Recordset") "update Appointment set ChildID='"&ChildID&"',VisitID='"&VisitID&"',StaffI D='"&StaffID&"',DateOfAppointment='"&DateOfAppoint ment&"',Time='"&Time&"',Remarks='"&Remarks&"' where AppointmentID='"&AppointmentID&"'","DSN=C"

ID of child is Updated

<form method ="POST"action="medicals.asp">
<input type=Submit value="Back">
Dec 31 '10 #3

Expert 2.5K+
P: 3,405
1- print out your update statement (use response.write and the exact code you are trying to send to the db)
2- try that update statement in a query analyzer

I suspect the problem is you are posting text when you should be posting a number
Expand|Select|Wrap|Line Numbers
  1. childID='219' //this will probably give an error
  2. childID=219. //this is probably right
The next time you post you must say that you printed out the sql statement and tested it in access or I will not answer. Also note that your code should be in code tags (use the button marked #).

Dec 31 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.