SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 7th, 2004, 01:56 PM
edmondj edmondj is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 72 edmondj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 26 m 43 sec
Reputation Power: 5
Question Missing ), ], or Item in query expression error!!

Hi
I can't figure out why my Update / Select statment is not working The syntax for the sub query looks correct
Here is the code. This is driving me nuts, its probably something simple, but i can't see it Any help will be appreciated

uRecord = "UPDATE " & dLocation & " SET RepairTech ='" & Request.Form("rtechnicianListBox") & "'"
uRecord = uRecord & " WHERE ID IN(Select ID FROM InProcessQuality WHERE ID = " & Request.QueryString("record"))

It gives me this error



Microsoft JET Database Engine error '80040e14'

Missing ), ], or Item in query expression 'ID IN(Select ID FROM InProcessQuality WHERE ID = 226'. /repair.asp, line 39




Reply With Quote
  #2  
Old May 7th, 2004, 02:26 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
Click here for more information.
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,781 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 45 m 55 sec
Reputation Power: 470
why can't you just do this???
Code:
uRecord = "UPDATE " & dLocation & " Set RepairTech = '" & Request.Form("rtechnicianListBox") & "' WHERE [ID] = " & Request.QueryString("record")

Reply With Quote
  #3  
Old May 7th, 2004, 02:34 PM
edmondj edmondj is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 72 edmondj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 26 m 43 sec
Reputation Power: 5
Question RepairTech is in InProcessRepair table and ID is in InProcessQuality table

The reason why I was doing the sub query because RepairTech is in InProcessRepair table and ID is in InProcessQuality table.
Its not working because it doesn't know where ID is coming from and gives me the error. That is why I had to do the sub query

uRecord = "UPDATE " & dLocation & " SET RepairTech ='" & Request.Form("rtechnicianListBox") & "'"
uRecord = uRecord & " WHERE [InProcessQuality.ID] IN (SELECT [InProcessQuality.ID] FROM [InProcessQuality] WHERE [InProcessQuality.ID] = " & Request.QueryString("record"))



uRecord = "UPDATE " & dLocation & " Set RepairTech = '" & Request.Form("rtechnicianListBox") & "' WHERE [ID] = " & Request.QueryString("record")


Reply With Quote
  #4  
Old May 7th, 2004, 02:40 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
Click here for more information.
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,781 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 45 m 55 sec
Reputation Power: 470
Your database structure doesn't make sense.
You should never have to do that type of update, because they are unpredictable.

The table containing RepairTech should have a primary key, you should do the update based on that tables primary key.

Reply With Quote
  #5  
Old May 7th, 2004, 03:32 PM
edmondj edmondj is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 72 edmondj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 26 m 43 sec
Reputation Power: 5
Exclamation

I'm just confused on how I can restructure the tables. InProcessQuality can have many ordernumbers each with a different serialNumber. When I load the page for the Inprocessrepair it should show the data if the ordernumber and the serialnumber and the id from InProcessQuality to differentiate which record to show. that is why I am trying to select the * from InProcessRepair and InProcessQuality -> SerialNumber, OrderNumber and ID so i can update the table. Not sure if i am making any sense, haha its been a long day! can you tell

Reply With Quote
  #6  
Old May 7th, 2004, 05:23 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
Click here for more information.
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,781 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 45 m 55 sec
Reputation Power: 470
You should have a column in each table that links them together.

Reply With Quote
  #7  
Old May 12th, 2004, 12:35 PM
syed syed is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 1 syed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up

Hi Edmondj, try this please
uRecord = "UPDATE " & dLocation & " SET RepairTech ='" & Request.Form("rtechnicianListBox") & "'"
uRecord = uRecord & " WHERE ID IN(Select ID FROM InProcessQuality WHERE ID = " & Request.QueryString("record") & " )"



OR


uRecord = "UPDATE " & dLocation & " SET RepairTech ='" & Request.Form("rtechnicianListBox") & "'"
uRecord = uRecord & " WHERE ID IN(Select ID FROM InProcessQuality WHERE ID = '" & Request.QueryString("record") & "' )"


Cheers!

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Missing ), ], or Item in query expression error!!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT