Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mparter
Yak Posting Veteran
86 Posts |
Posted - 2002-05-20 : 11:54:46
|
| I have the following SELECT query:rst.Open "SELECT NINo, Email, Password, AccountStatus, LastLogin FROM StaffMember WHERE NINo = '" & Request("userid") & "' UNION SELECT NINo, Email, Password, AccountStatus, LastLogin FROM GuestAccounts WHERE NINo = '" & Request("userid") & "'", dbs, 1, 3 rst("Username") = Request("txtUsername")rst("Password") = Request("txtPassword")rst("Email") = Request("txtEmail")rst.Updaterst.CloseBut it doesn't work, I get the following error:Microsoft OLE DB Provider for ODBC Drivers error '80040e21' Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.I cannot figure out what's wrong! |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-05-20 : 12:09:48
|
| You can't update a UNION query at all. Updates can only be done against a table or an updateable view (Books Online has more details on what kinds of views can be updated)The big problem is this: which table is being updated, StaffMember or GuestAccounts? If the rows cannot be uniquely identified, they can't be updated.I would recommend that you use stored procedures for your update operations, instead of the ADO Recordset Update method. You'll avoid problems like these. |
 |
|
|
|
|
|
|
|