thamks to Bill Wilkinson but!!!!!!

Results 1 to 2 of 2

Thread: thamks to Bill Wilkinson but!!!!!!

  1. #1
    Join Date
    Dec 1969

    Default thamks to Bill Wilkinson but!!!!!!

    I am stuck even more, my last bit of trouble was binding a datalist to a database table. Clicking on a record in the list and by use of a submit button I opened another page which populated text boxes with the selected couples data.<BR>This is what I needed to do and I did manage it.<BR>However with this page and all its data on display I now wanted to be able to edit some of the data on display.<BR>So I used the objRS.Update method to update the particular record and a submit button to insert the record back into the database.<BR>The record produced was created by the sql<BR>sql="Select * from tblCouple where cpleID="& request<BR>("CoupleChoice")<BR>set objRS = server.createobject("ADODB.Recordset")<BR>objRS.Op en"tblCouple" ,objConn,,adlockOptimistic,adCmdtable <BR>objRS("cpleFemFirstName") =request.form("FemFirstName")<BR>..... and all the other fields followed by<BR>objRS.Update<BR>objRS.Close<BR>However this didn&#039;t entirely work as the submittal of the record sent the data straight to the first row of the table. So it wrote over the first record and did not find the record with the same primary key(cpleID) which in the access database is an auto no.<BR>So the record always went to no.1 in the database.<BR>So why can&#039;t the record remain with its respective identifier and not override the first record in the table. <BR>I thought because with the cpleID being the identifier it would allow the record to be submitted according to the cple ID which came initially from the request form. <BR>

  2. #2
    Join Date
    Dec 1969

    Default You are missing ADDNEW

    objRS.Open"tblCouple" ,objConn,,adlockOptimistic,adCmdtable<BR>[hl="yellow"]objRS.AddNew[/hl] <BR>objRS("cpleFemFirstName") =request.form("FemFirstName")<BR>..... and all the other fields followed by<BR>objRS.Update<BR>objRS.Close<BR><BR>********* *****<BR><BR>Without that, *indeed* you would--and should--change the first record in the table, because that&#039;s exactly what you were asking to do!<BR><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