"The data types text and nvarchar are incompatible in the equal to operator" in SQL Query

Posted by kenom on Stack Overflow See other posts from Stack Overflow or by kenom
Published on 2010-05-03T23:35:30Z Indexed on 2010/05/03 23:48 UTC
Read the original article Hit count: 275

Filed under:

Why i get this error:

The data types text and nvarchar are incompatible in the equal to operator. The field of "username" in database is text type...

This is my soruce:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="my_answers.ascx.cs" Inherits="kontrole_login_my_answers" %>

<div style=" margin-top:-1280px; float:left;">       

<p></p>


                              <div id="question">
Add question





</div>
</div>
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" 

   >

</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:estudent_piooConnectionString %>" 
    SelectCommand="SELECT * FROM [question] WHERE ([username] = @fafa)">
    <SelectParameters>
        <asp:QueryStringParameter Name="fafa" QueryStringField="user" 
            Type="String"/>
    </SelectParameters>
</asp:SqlDataSource>

© Stack Overflow or respective owner

Related posts about sql