ariez

ariez

  • NA
  • 34
  • 0

updating records using ACCESS

Jun 14 2010 6:37 AM

in this page administrator can update the records of users.he will 1st enter user's id to search the record of a particular user and then all the stored data about user like FullName, MobileNumber, CreationDate, CNIC appears in the respective textboxes.we have made two different attempts but none succeeded.
In attempt1, i thought of updating "registration" table with respect to the user's id.
In attempt2, I then thought of first deleting the record and then writing the new record for the same id.
The error in both attempts is mentioned below.
ERROR: "Syntax error (missing operator) in query expression "
Coding behind the "update" button is as follows.
attempt1:
// string query4 = "UPDATE registration SET FullName,MobileNumber,CreationDate,CNIC='" + FullName.Text + "','" + MobileNumber.Text + "','" + CreationDate.Text + "','" + CNIC.Text + "' where Id='" + id_textbox.Text + "'";
attempt2:
//string query4 = "delete FullName,MobileNumber,CreationDate,CNIC from registration where Id ='" + id_textbox.Text + "'";
        string query4 = "delete from registration where Id = '" + id_textbox.Text + "' ";
        conn.delete(query4);
        string query5 = "INSERT into registration (FullName,MobileNumber,CreationDate,CNIC,Id) values (''" + FullName.Text + "','" + MobileNumber.Text + "','" + CreationDate.Text + "','" + CNIC.Text + "','" + id_textbox.Text + "')";
        conn.insert(query5);
        Response.Write("<script>alert('Record Updated')</script>");

Answers (3)