Confirming Inserts into Database

Results 1 to 2 of 2

Thread: Confirming Inserts into Database

  1. #1
    Join Date
    Dec 1969

    Default Confirming Inserts into Database

    HI, <BR>what is the best method for confirming that a record has been inserted into an Acces97 database? <BR>I have come across a few problems where a user submits his/her registration and the ASP application seems to work correctly, but when I check the database ther is no entry.<BR><BR>Any suggestions?

  2. #2
    Jeremy_D Guest

    Default RE: Confirming Inserts into Database

    The fool-proof (and fault-proof) way would be to check the existence of the record after the insert by using its PK:<BR><BR>INSERT INTO MyTable (PK_Column, Value_Column) VALUES (12345, "test")<BR>SELECT Count(1) FROM MyTable WHERE PK_Column = 12345<BR><BR>Second query will return 1 if the record was inserted, and 0 if it wasn&#039;t. Of course this will go wrong if a row with PK 12345 already existed when you ran the insert query, but you would get a PK violation error in that case, so that&#039;s easy to check.<BR><BR>I think it&#039;s more important to find out _why_ the inserts don&#039;t work though. Could be a client-problem or good ol&#039;-fashioned access DB corruption - in any event, if an insert fails for some reason you should get an error. If you don&#039;t there&#039;s something seriously wrong.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts