Reply to topic
SQL Error
Josh
Forum Regular

Joined: 01 Apr 2004
Posts: 1031
Location: Felton, Delaware
Reply with quote
TABLE STRUCTURE
Code:
Product
ProductID, VendorID, CategoryID, Product, Version, Notes

License
LicenseID, ProductID, CpuID, License, Notes

CPU
CpuID, Serial, Desc, Assigned


SELECT Product.ProductID, Product.Product, License.License, CPU.Desc, CPU.Assigned
FROM Product
INNER JOIN License ON License.ProductID = Product.ProductID
INNER JOIN CPU ON CPU.CPUID = License.CPUID
WHERE [Product].CategoryID=1 AND [Product].VendorID=1

This is with an access DB using ASP.NET... wtf's wrong with that?

Here's the error
Code:
System.Data.OleDb.OleDbException: Syntax error (missing operator) in query expression 'License.ProductID = Product.ProductID INNER JOIN CPU ON CPU.CPUID = License.CPUID'.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReader()
at ASP.index_aspx.Search(Object Sender, EventArgs e) in c:\Inetpub\inventory\Index.aspx:line 99
bobum
Elvis Fanatic
Elvis Fanatic

Joined: 16 Nov 2004
Posts: 746
Location: Montgomery, AL
Reply with quote
Try enclosing your CPU.Desc in brackets ala CPU.[Desc]

After all - Desc is a SQL reserved word...
Josh
Forum Regular

Joined: 01 Apr 2004
Posts: 1031
Location: Felton, Delaware
Reply with quote
ahhhh yes!!! Good eye!!! Eye didn't see that Wink
Josh
Forum Regular

Joined: 01 Apr 2004
Posts: 1031
Location: Felton, Delaware
Reply with quote
****... still didn't work. Same error, same place.
bobum
Elvis Fanatic
Elvis Fanatic

Joined: 16 Nov 2004
Posts: 746
Location: Montgomery, AL
Reply with quote
Access may be different but I recreted your table structure and that query in SQLServer and that fixed it for me...without the [] I got your error...with em it was ok...I dunno what else to tell you.
Josh
Forum Regular

Joined: 01 Apr 2004
Posts: 1031
Location: Felton, Delaware
Reply with quote
Yeah... unfortunately I don't have the option of MSSQL or I would have used that... GRRRR!!!

I hate access... I don't know why it hates me though...
Josh
Forum Regular

Joined: 01 Apr 2004
Posts: 1031
Location: Felton, Delaware
Reply with quote
Okay... fixed it... this is the most retarded "answer" i've found to date... I had to wrap a section of my FROM clause and my first (but not the second) INNER JOIN in parentheses...

Code:
SELECT Product.ProductID, Product.Product, License.License, [CPU].[Desc], [CPU].Assigned
FROM (Product
INNER JOIN License ON License.ProductID = Product.ProductID)
INNER JOIN [CPU] ON [CPU].CPUID = License.CPUID
WHERE [Product].CategoryID=1 AND [Product].VendorID=1


*kicks access*
SQL Error
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic