Posts

Showing posts from June, 2020

Cannot resolve collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" error

These kind of errors are often thrown in sql. Today i am going to tell you ,how to resolve this error. At first we should identify which column creates this issue. Next we have to add " COLLATE DATABASE_DEFAULT " this keyword next to the column. Now you won't have this error. Example: select e.employeeName COLLATE DATABASE_DEFAULT from employee

Comma separated strings to distinct list conversion in C#

Today we are going to see that how to convert comma separated string to list conversion . I hope we may come across this kind to situation. So it will be more helpful . string commaSeparatedString ="1,2,3,4,5,,6"; List<string> lstDistinctString = new List<string>(); lstDistinctString = commaSeparatedString. Trim().Split(',').Where(s =>           !string.IsNullOrWhiteSpace(s)).Distinct().ToList() ; Output: 1 2 3 4 5 6