Blank spaces at end of text being saved?

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

When I save text from textbox, regardless of whether I use
rtrim or selectlength, it seems to save the length of
field set in the table on the server, with text and blank
spaces.

When the text is loaded back in the text box for the user
to edit, they must highlight the blank spaces at the end
of the existing text in order to add additional text.
Maximum length has been filled with blank spaces. How do
I save only the text and not the blank spaces?

Thank you
 
Sam said:
When I save text from textbox, regardless of whether I use
rtrim or selectlength, it seems to save the length of
field set in the table on the server, with text and blank
spaces.

When the text is loaded back in the text box for the user
to edit, they must highlight the blank spaces at the end
of the existing text in order to add additional text.
Maximum length has been filled with blank spaces. How do
I save only the text and not the blank spaces?

You may want to use the 'Trim' function to remove the spaces.
 
Hi Sam,

your full name would be nice.

| When I save text from textbox, regardless of whether I use
| rtrim or selectlength, it seems to save the length of
| field set in the table on the server, with text and blank
| spaces.

Maybe you missed to set the correct data type of the column. For instance,
on SQL Server there are two data types to store string values. In columns of
type varchar(10) strings are saved as is (variable length), while char(10)
fills strings with trailing spaces until 10 characters are reached.

HTH,

Alex
_______________________________________

Alexander Groß
Dipl.-Ing. (BA) für Informationstechnik
(e-mail address removed)
http://www.it99.org/axl
Wired: +49 (0) 3 41 / 47 84 97 70
Cellular: +49 (0) 1 75 / 410 72 68
ICQ# 36765668
_______________________________________
 
MS Access only has fixed length strings, so I guess the solution is what
Herfried suggested, before putting the value into the edit box, trim it.
 
If you are using SQL, switch the text fields from VarChar to NavChar to fix
the problem. VarChar will store data for each space designated for the
field size. For example, if the field size is 20, and you have "Hi", the
field will still be 20... "Hi " If you set it to NavChar,
it would be "Hi"

HTH,
Brian P. Hammer
 
?

What is "NavChar"? And since when is VARchar not VARiable length?

I think you mean to change the field from CHAR to VARCHAR, right? (Or to
NVARCHAR, which is the Unicode version of VARCHAR)
 
Darn, how did I get that far off. I'd blame it on the keyboard but ... :-)

Yes, nvarchar is what I mean. Better go and review my SQL stuff again.
It'll get him pointed in the right direction.

Thanks for jumping in.
 
Hi Chris,

| MS Access only has fixed length strings, so I guess the solution is what
| Herfried suggested, before putting the value into the edit box, trim it.

Sam didn't say she's using Access. She wrote something about a database
server. However, she told us that it doesn't matter if she uses rtrim, which
trims the right side of the string. So I guess she is using a database that
supports variable-sized strings.

Alex

_______________________________________

Alexander Groß
Dipl.-Ing. (BA) für Informationstechnik
(e-mail address removed)
http://www.it99.org/axl
Wired: +49 (0) 3 41 / 47 84 97 70
Cellular: +49 (0) 1 75 / 410 72 68
ICQ# 36765668
_______________________________________
 
I will change the datatype in SqlServer to VarChar.

Thanks, Samantha
Systems Developer Chem-Dry Canada
 
Back
Top