I was trying to query my userName from the database...it was stored as firstname, middlename and lastname and being the dunce I am, I did the simple
Select firstName+' '+MiddleName+' '+lastName as userName from members
Right ?
WRONG !!!
If any of the cols is a null, which usually is for the middle name, the concatanation returns null...
BOOOO
So, now am doing this instead
Select ltrim(isnull(FirstName,'')+' '+isnull(MiddleName, '')+' '+isnull(LastName,'')) as userName from members
and all is well in my world again !!!
Please, oh Google-gods, rank this blog prominently, and let's save some poor, misguided souls who might be searching for some code on formating a query string in C# or merely grazing for urdu shayaris.... If just one person sees the light, then I've done my job! .... Yes, I am not above shamelessly begging the search engines for relevance .... it's called SEO, right?)
Friday, December 17, 2010
Tuesday, December 14, 2010
So I had a gridview which had no data... Now what...
AHhh.. there is empty data template for gridview ... Woo Hoo... here it goes from microsoft site :
The empty data row is displayed in a GridView control when the data source that is bound to the control does not contain any records. You can define your own custom user interface (UI) for the empty data row by using the EmptyDataTemplate property.
Subscribe to:
Posts (Atom)