sql error help

hey everyone, i am trying to output this query in html through javascript. the error it gives me is error # 2147217913 error converting datatype nvarchar to numeric

code: var ItemCode;

ItemCode = window.prompt ("enter items lookup code"," "); var sql = "SELECT [Transaction].Time, [Transaction].TransactionNumber, TransactionEntry.Price, TransactionEntry.Quantity, Item.Description FROM TransactionEntry INNER JOIN [Transaction] ON TransactionEntry.TransactionNumber = [Transaction].TransactionNumber AND TransactionEntry.StoreID = [Transaction].StoreID INNER JOIN Customer ON [Transaction].CustomerID=Customer.ID LEFT JOIN Item ON TransactionEntry.ItemID = Item.ID LEFT JOIN Store ON TransactionEntry.StoreID = Store.ID"; sql = sql + " WHERE Item.ItemLookUpCode = " + ItemCode;

any help will be much appreciated

Reply to
Shoby
Loading thread data ...

Try This:

sql = sql + " WHERE Item.ItemLookUpCode = '" + ItemCode + "'";

Reply to
Glenn Adams [MVP - Retail Mgmt]

thank you Glen, Silly mistake on my side. thank you for your help that solve the problem shoby

Reply to
Shoby

BeanSmart website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.