Click here to Skip to main content
15,885,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to select productid, productname and unitprice form Products table and Quantity form ShoppingCart table.. ShoppingCart Table have ( ProductID,CustomerID,Quantity attributes)

i wrote a sql query for that it seems right but there is an error Can't Find table 0


The Query is

C#
select Products.ProductID,Products.ProductName,Products.UnitPrice,ShoppingCart.Quantity from Products LEFT JOIN ShoppintCart on Products.ProductID=ShoppingCart.ProductID"; 


On Sql Server I am getting an Error Invalid Object Name Products
Posted
Updated 20-Sep-11 9:33am
v2

Since ShoppingCart is in singular form even though many Shopping carts are stored in it maybe the table name Products is wrong and it should be Product instead. In my opinion tables should always be in singular form unless one row expresses something that would have to be expressed as a plural.

If you made sure that Products is indeed the correct name of your table, you also have to make sure that you are using the correct database. If your default databasee is master or some other database that does not contain your tables you can always use the T-SQL[^] statement use <database name>[^].

Best Regards,

-MRB
 
Share this answer
 
v2
This error means your SQL query can't find the table "Products" where it is trying to look for it. It could be that you pointed the query to the wrong database, that you forgot to create your table or that you misspelled the table name when you created it.

Good Luck
 
Share this answer
 
v2
ShopintCart ? Shouldn't that be ShopingCart?

Cheers!

MRB
 
Share this answer
 
Comments
codegeekalpha 20-Sep-11 15:14pm    
opps thax.. i correct it ..but still getting the same error???
Manfred Rudolf Bihy 21-Sep-11 3:27am    
Please see my alternate solution for additional information.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900