Saturday, February 25, 2012

Can anyone help and tell me what i am doing wrong?

Here is the code

Line 84:
Line 85: searchDataAdapter = New System.data.sqlclient.sqldataadapter("SELECT * FROM Inventory Where title=" & title, searchConnection)
Line 86: searchDataAdapter.Fill(objItemInfo, "ItemInfo")
Line 87:
Line 88: Return objItemInfo

here is the error
Line 1: Incorrect syntax near '='.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near '='.

Source Error:

Try adding single quotes:

searchDataAdapter = New System.data.sqlclient.sqldataadapter("SELECT * FROM Inventory Where title='" & title & "'", searchConnection)

HTH,
Ryan

|||Hey Thanks, it worked....I knew it was something simple like that|||

try this

SELECT * FROM Inventory Where title=' " & title & " '

No comments:

Post a Comment