I'm working with VS2010 and asp.net and build a SQL Server Database with some int and char values.
My problem is, that the char(50) automatically fills the unused chars with whitespaces like:
"foo "
What can i do to get only "foo"?
I'm working with VS2010 and asp.net and build a SQL Server Database with some int and char values.
My problem is, that the char(50) automatically fills the unused chars with whitespaces like:
"foo "
What can i do to get only "foo"?
It's not Visual Studio that's adding the white spaces, but your datatype.
Char is fixed-length, while varchar is variable length. Char will pad the remaining text with spaces up to your field length.
You can see more information about SQL datatypes here.