View Single Post
  #1 (permalink)  
Old August 13th, 2003, 12:50 PM
mcalder mcalder is offline
Registered User
 
Join Date: Aug 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mcalder Send a message via Yahoo to mcalder
Default Help! Cannot update records

Im new to asp so i found some code on the net and just changed it around a bit. I would like to be able to add,delete, and update records. So far only the add and delete work. Any assistance would be much appreciated.
Here comes the code:
 <%
    Set rs = conn.Execute(SQLstmt)
    IF NOT RS.EOF THEN
    %>
      UPDATE
      <FORM METHOD="post" ACTION="jobs.asp?Actionvar=UPDATE">
      <B>Client</B> <INPUT TYPE="text" NAME="Client" VALUE="<%=rs("Client")%>"><BR>
      <B>Dates</B> <INPUT TYPE="text" NAME="Dates" VALUE="<%=rs("Dates")%>"><BR>
      <B>Phone Number</B> <INPUT TYPE="text" NAME="Employee" VALUE="<%=rs("Employee")%>"><BR>
      <B>TimeStart</B> <INPUT TYPE="text" NAME="TimeStart" VALUE="<%=rs("TimeStart")%>"><BR>
      <B>TimeFinished</B> <INPUT TYPE="text" NAME="TimeFinished" VALUE="<%=rs("TimeFinished")%>"><BR>
      <B>Parts</B> <INPUT TYPE="text" NAME="Parts" VALUE="<%=rs("Parts")%>"><BR>
      <B>Details</B> <INPUT TYPE="text" NAME="Details" VALUE="<%=rs("Details")%>"><BR>
      <INPUT TYPE="hidden" NAME="flag" VALUE="2">
      <INPUT TYPE="hidden" NAME="Recordid" VALUE="<%=rs("ID")%>">
      <INPUT TYPE="submit" VALUE="UPDATE">
      </FORM>
      <%
      rs.MoveNext
      rs.Close
    END IF
  ELSEIF Request.Form("flag")="2" THEN
    SQLstmt = "UPDATE jobs SET "
    SQLstmt = (SQLstmt) & "client='" & TRIM(Request.Form("client")) & "'"
    SQLstmt = (SQLstmt) & "Dates= '" & TRIM(Request.Form("Dates")) & "' "
    SQLstmt = (SQLstmt) & "Employee='" & TRIM(Request.Form("Employee")) & "'"
    SQLstmt = (SQLstmt) & "TimeStart= '" & TRIM(Request.Form("TimeStart")) & "' "
    SQLstmt = (SQLstmt) & "TimeFinished= '" & TRIM(Request.Form("TimeFinished")) & "' "
    SQLstmt = (SQLstmt) & "Parts='" & TRIM(Request.Form("Parts")) & "'"
    SQLstmt = (SQLstmt) & "Details= '" & TRIM(Request.Form("Details")) & "'"
    SQLstmt = (SQLstmt) & " WHERE ID=" & TRIM(Request.Form("Recordid"))
    %>

    SQL Partsment: <%=SQLstmt%>

    <%
    Conn.Execute(SQLstmt)
    Response.Write "Operation Complete<br><A HREF=""jobs.asp"">Home</A>"
  END IF

Reply With Quote