SqlException - Help pls

V

VB Programmer

Using SQLServer database. UserId defined as numeric and First/LastName
fields defined as nvarchar(50).

Here is my SQL Statement:
SELECT UserId, LastName & ', ' & FirstName AS FullName FROM Users ORDER BY
LastName, FirstName;

What does this error mean?
Server Error in '/Test' Application.
________________________________________
Invalid operator for data type. Operator equals boolean AND, type equals
nvarchar.
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: Invalid operator for
data type. Operator equals boolean AND, type equals nvarchar.

Source Error:
Line 136: End If
Line 137:
Line 138: Dim dr As SqlDataReader =
MySqlHelper.ExecuteReader(CONNECTION_STRING, CommandType.Text, strSql)
Line 139:
Line 140: Return dr

Source File: c:\inetpub\wwwroot\Test\Components\dbUsers.vb Line: 138

Stack Trace:
[SqlException: Invalid operator for data type. Operator equals boolean AND,
type equals nvarchar.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(SqlConnection
connection, SqlTransaction transaction, CommandType commandType, String
commandText, SqlParameter[] commandParameters, SqlConnectionOwnership
connectionOwnership)
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(String
connectionString, CommandType commandType, String commandText,
SqlParameter[] commandParameters)
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(String
connectionString, CommandType commandType, String commandText)
Test.dbUsers.GetAllUsers(Int32 UserId) in
c:\inetpub\wwwroot\Test\Components\dbUsers.vb:138
Test.ManageUsers.FillUsersDdl() in
c:\inetpub\wwwroot\Test\Secured\ManageUsers.aspx.vb:139
Test.ManageUsers.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\Test\Secured\ManageUsers.aspx.vb:59
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

________________________________________
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top