I have a C# console application which simply pulls information from a Sql Server 2008 database and outputs it to an excel sheet.
I am using Linq to Entities.
Here is a snippet of the code just to demonstrate how I output the data from the database to the excel sheet.
cell = dataRow.CreateCell(colPosition++); // Title Group ID
cell.SetCellValue(currentTitle.TitleGroupID);
My issue is, that in my database, the Users name is stored as his/her full name, e.g. “John Smith”, however, in the excel sheet this is separated into First Name and Last Name.
Is there a way to parse the users name into First Name and Last Name?
Thanks in advance, if more info is needed, just ask 🙂
The thing is with name is that they are complicated. So for short, no you can’t do that since it is basically impossible to know what is a last name and first name from a full name. But you can go with the assumptions that the last part is always the last name (even though that is not the case in many situations) and split the string on space.