Hi
I have a very annoying problem with LINQ and MS SQL Server.
Im currently making some software in WPF C# and use LINQ to generate classes from the data in the database.
However, when i update a nvarchar or varchar field in the DB from my program, LINQ adds trailing spaces to the string!
I have a field in a table defined like this:
ProductName = NVARCHAR(10)
So if i do this:
Product.Name = "Bike";
Product.Name = Product.Name.Trim();
repository.Add(Product); // Runs an .InsertOnSubmit
repository.Save(); // Runs a .SubmitChanges
then the resulting data in the DB is "Bike[SPACE][SPACE][SPACE][SPACE][SPACE][SPACE]" where [SPACE] is just a space (can't write multiple spaces in this text here).
Why does it do this, and how do i make it stop adding those annoying trailing spaces?
Thanks in advance