Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update record problem

Status
Not open for further replies.

frogggg

Programmer
Jan 17, 2002
182
US
I'm probably not going about this in the proper way, but it's making me problems:
I have a page that displays all the user's info and also all the job posts he made with their info and an option to change them.
So I opened up a recordset with all the post info where EmployerID = EmployerID. So far, so good. Then, while not eof, I displayed all the info for each post. Also, works great. Then, before the moveNext, I put an update button(onClick = rs.updateRecord), so that each post has its own update button, so each post can be changed on its own(I thought). But, when I click on the button, the page displays only the post which was changed, with all the information from all the other posts stuck into that record, and that's what happens in the database too. All the previous records' values get stuffed into that one's.

I would try to post some code but it's mostly dtc's so I'll just show what's going on. If someone can tell me the right way to do this, I would be so gratefull.

'open employer post recordset
rsEmpPosts.setSQLText("SELECT JobInfo.* " _
& "FROM JobInfo " _
& "WHERE JobInfo.EmployerID =" & employerID)
rsEmpPosts.open


'display each post
do while not rsEmpPosts.EOF
Response.Write &quot;Post Number: &quot; & rsEmpPosts.fields.getValue(&quot;ReferenceNum&quot;) & &quot;<br>&quot;

'here I have dtc's to display all the info for this post
'here I have an update button

rsEmpPosts.moveNext
loop
 
just as a guess, it sounds like the employerID is not unique enough. john doe has 4 postings but they all fall under the same employer id so when the update is done it's grabbing everything based on the employerID. do you have an autonumber field? try using that as your identifier, cause it should be truly unique, for which record to update and see if that fixes it. &quot;Where's the Ka-Boom? There's supposed to be an Earth-shattering Ka-Boom!&quot;
Marvin the Martian
 
The sql statement is bringing back more than one record - it's supposed to. Where would I reference the ReferenceNum (which is the primary key for each post) so that the update would only update that single record?

Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top