Server Explorer in Visual Studio(2010)

321 Views Asked by At

I'm working on Visual studio(2010) and using Server Explorer for database connectivity(SQL SERVER) . I am able to connect with it sql client easily, just the problem I'm facing is using the "WHERE" clause in sql query. When I write simple sql query like "Select * From Employee" then it is executing fine, but when I write "select * from Employee where EmpNo=1001 " Then it gives following error:

Error in WHERE clause near 'Employee'. Unable to parse query text.

Then when I click continue the error that comes is: SQL Execution Error: Error source: .NetSqlClientDataProvider Error Message: An expreesion of non-boolean type is provided where a condition is expected , near 'No'

Can someone please hepl with it..??

1

There are 1 best solutions below

1
On

From your error message you must be putting a space between Emp and No.

If the EmpNo fieldname is two words in your table, surround it with [] eg; [Emp No]