Skip to main content

Posts

Showing posts from April, 2010

Invalid Syntax when posting Detail Grid

No for the first time did I get "System.Data.SqlClient.SqlException: Incorrect syntax near 'nvarchar'." After pottering around on the internet for a while I looked at my Select query which read:
"SELECT ProductID, ItemTypeID, [Stock Code], Item, Available, Display, DeliveryCharged, CODPrice, RRP FROM ProductsTbl WHERE (ItemTypeID = @ItemTypeID) "

All I did we replace this
[Stock Code] As StockCode

And then edited the Boundfield value to be:

<asp:BoundField
  DataField="StockCode"
  HeaderText="Stock Code"
  SortExpression="Stock Code"
/>