This project is read-only.

Adding new fields to ticket caused error on My issues

Jan 24, 2010 at 4:51 PM

Hi

I added a new String field called ip_adr on both View_ticket and New Ticket forms by adding the new field in the tickets table and in the following files :

ticket.aspx, new_ticket.aspx, new_ticket.aspx.cs, db.designer.cs and Tickets.cs 

I had correct results on both View Ticket and New Ticket but when I launched My issues form I had the following error :

The text data type cannot be selected as DISTINCT because it is not comparable.

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: The text data type cannot be selected as DISTINCT because it is not comparable.

Source Error:

Line 54:             }
Line 55: gvMy.DataSource = myTickets;
Line 56: gvMy.DataBind();
Line 57: gvGroup.DataSource = groupTickets;
Line 58: gvGroup.DataBind();


Source File: c:\Inetpub\wwwroot\Slick-Ticket\my_issues.aspx.cs    Line: 56

What have to adjust more to correct this problem. Please Advice.

Thanks

Jan 27, 2010 at 3:26 AM

Both Tickets.MyTickets and Tickets.MyGroupsTickets call Tickets.ICommentedIn (these are in DomainModel) which has a distinct in it, that is causing your problem since you are using a TEXT variable.  Since I am assuming it is just an IP address, it would be smarter to use a NVARCHAR instead - it will take up less space and be distinguishable.

Jan 27, 2010 at 10:23 AM

I did change the datatype of ip_adr field to nvarchar(MAX) on the tickets table but I'm still having the same error !!

Please advice. I'm really brand new in aspx (.NET) programming. Which specific file (.cs, .aspx ...) do I have to change if any ? 

Thanks

Feb 4, 2010 at 4:51 AM

This is a little in-depth if you are newer.  

First you have to change the DB which it looks like you did.

Next you have to update the dbml file in the DomainModel

Then you have to dig through the methods in the domainmodel and find everywhere you want to expose your new fields

Then you will go into the UI and make it so the users can interact with them

 

It is easy in a sense if you are experienced with building CRUD systems, but not really that easy... :P

Feb 8, 2010 at 8:19 PM

Naspinski  how do you generate you dbml file?  Are you using SQLMetal? If so could you share your command line input?

 

I tried generating a new DBML file from an unedited version of the database to make sure it would work. I ended up getting all sorts of errors related to the classes (comment, user,ticket, ect...)

 

Thanks.