In SQL Server, this can come up when the table you are updating has no primary key (which of course would uniquely identify each row.) So when the database engine goes to do an update, it can't figure out exactly which row to update, so it bails out and gives us that error message.
Is there a unique PK column on the table you are updating?
Jorgandr, that was it exactly! How did you ever guess?
Well, now can you help me make the next sql statement.
The story is like this:
The recordset checks a username and password from an html form from the page before against the database, and brings back the entire record for approval and possible update. Several of the fields in the table are lookup fields, so in order to display the info properly, I had to include other tables, as you figured out. Here's the sql statement that I have so far. Do I need to make another recordset without the additional tables and update from that? Another question: the fields that were lookups, I hadn't displayed the dropdown box, because I didn't know how to do that and display the record from the database. Can you help with this too? Will this make the same error/problem as before?
ok... Here is a quick example of what you want to do. You can use your SELECT statement from before but you do need to include 2 more recordsets if you want to use drop downs. in your form you want to do this..
RSState = conn.execute("SELECT StateName, StateID FROM STATE"
and of course now your UPDATE SQL statement can compare the Request.FOrm("State" with the CandidateContactInfo.State field... Hope this helps!
Thanks for your help.
Actually, I made a mistake. I did have the dropdown boxes working fine - I'm using VI, so the code you posted for populating the dropdown boxes is not really necessary - I got that figured out.
But I still don't know how to get the update working. Do I need to take the state and careerlevel info out of the first sql and I should populate those dropdown boxes using the code you posted?
Well in order to use dropdowns correctly your StateID and CareerID need to be the Value part of your dropdown's while the CareerName and StateName are only there for the user's benefit. For Instance using my code above, when they select OH-Ohio the value or the Request.Form("State" value is going to be the StateID that is attached to that StateName. Now because your dropdown's have values that are in your Main Table, CandidateContactInfo, your Update statement will be on that Ex.
UPDATE CandidateContactInfo SET State=" & Request.Form("State" & ", CareerLevel=" & Request.Form("CareerLevel" & " WHERE CustomerID=" & Request.FOrm("CustomerID" & "
Now because your updating on a single table and not a multipe you should have no problems.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.