Headbang: Annoyed users, trailing spaces, SQL 6.5 field length, txt box, MaxLength 
Author Message
 Headbang: Annoyed users, trailing spaces, SQL 6.5 field length, txt box, MaxLength

Man o man, I sure could use a few tips on this problem of mine.  It
seems so simple....

In the dataenviron I've got a working OLE DB connection to a SQL 6.5
server and a working updatable recordset.

I've got a form with a bunch of txt controls (aka single-line-edit)
bound to the fields of the recordset.

Alrighty.  Things work well, as long as what I input into a text box
doesn't exceed the field size (or else I get a "Data Access error".)
So to prevent errors, I set the MaxLength of the text box to, say, 40
characters, the size of the field to which the text box is bound.  

But here's the pisser: because all the fields in the database are
padded with spaces (as per the SQL recommendation) every text box is
automatically "full."  A four-letter word (which I find myself using a
lot recently) in a 40-char field fills up the text box with 36 spaces.

Here's why it's annoying.  If the user clicks on the text box and
types something, **nothing happens because the text box has reached
its MaxLength because of all the spaces.**  The user has to either 1)
double-click to highlight the text so subsequent keystrokes replace
the text, making room for what's to come or 2) drag-select a portion
of the text box.

My objective: a situation where a user can click on a text box and
(gasp) edit the field (without having to double-click or select or
replace all the text or other such nonsense.)

All hints and/or condolences (or gondolas) are VERY welcome.

(P.S. The solution, AFAIK, is NOT ANSI_PADDING.  that only affects in
coming data.  It doesn't lessen the squeeze of "full" text boxes read
from the db.)



Sun, 17 Feb 2002 03:00:00 GMT  
 Headbang: Annoyed users, trailing spaces, SQL 6.5 field length, txt box, MaxLength
I don't know if it's the best solution, and I don't know that I understand
completely, but you could put in a little function called in the got focus,
click and keypress events, passing it the value of the txtfield that does
something like this;

function TrimTheCrap(txtField as string)
dim sStr as string
sStr = Trim( txtField)
 then pass back sStr
doing this over and over until you have what you want...


Quote:

> Man o man, I sure could use a few tips on this problem of mine.  It
> seems so simple....

> In the dataenviron I've got a working OLE DB connection to a SQL 6.5
> server and a working updatable recordset.

> I've got a form with a bunch of txt controls (aka single-line-edit)
> bound to the fields of the recordset.

> Alrighty.  Things work well, as long as what I input into a text box
> doesn't exceed the field size (or else I get a "Data Access error".)
> So to prevent errors, I set the MaxLength of the text box to, say, 40
> characters, the size of the field to which the text box is bound.

> But here's the pisser: because all the fields in the database are
> padded with spaces (as per the SQL recommendation) every text box is
> automatically "full."  A four-letter word (which I find myself using a
> lot recently) in a 40-char field fills up the text box with 36 spaces.

> Here's why it's annoying.  If the user clicks on the text box and
> types something, **nothing happens because the text box has reached
> its MaxLength because of all the spaces.**  The user has to either 1)
> double-click to highlight the text so subsequent keystrokes replace
> the text, making room for what's to come or 2) drag-select a portion
> of the text box.

> My objective: a situation where a user can click on a text box and
> (gasp) edit the field (without having to double-click or select or
> replace all the text or other such nonsense.)

> All hints and/or condolences (or gondolas) are VERY welcome.

> (P.S. The solution, AFAIK, is NOT ANSI_PADDING.  that only affects in
> coming data.  It doesn't lessen the squeeze of "full" text boxes read
> from the db.)



Sun, 17 Feb 2002 03:00:00 GMT  
 Headbang: Annoyed users, trailing spaces, SQL 6.5 field length, txt box, MaxLength
I never read the SQL chapter on space-filling char fields.
So, I never experienced your frustration. <g>.

You *could* do alot of extra work if the control has an AfterUpdate
BeforeUpdate, or such, and Trim the incoming and pad the outgoing.
But why?


Quote:

> But here's the pisser: because all the fields in the database are
> padded with spaces (as per the SQL recommendation) every text box is
> automatically "full."  A four-letter word (which I find myself using a
> lot recently) in a 40-char field fills up the text box with 36 spaces.



Sun, 17 Feb 2002 03:00:00 GMT  
 Headbang: Annoyed users, trailing spaces, SQL 6.5 field length, txt box, MaxLength
Why not use varchar instead of char in the database?  I think that is how I
worked around that problem in the past.

Joe

Quote:

>I never read the SQL chapter on space-filling char fields.
>So, I never experienced your frustration. <g>.

>You *could* do alot of extra work if the control has an AfterUpdate
>BeforeUpdate, or such, and Trim the incoming and pad the outgoing.
>But why?



>> But here's the pisser: because all the fields in the database are
>> padded with spaces (as per the SQL recommendation) every text box is
>> automatically "full."  A four-letter word (which I find myself using a
>> lot recently) in a 40-char field fills up the text box with 36 spaces.



Mon, 18 Feb 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Headbang: Annoyed users, trailing spaces, SQL 6.5 field length, txt box, MaxLength

2. Space in Field Name,SQL 6.5 ADO

3. Loading Rich Text Box from SQL Server 6.5 Text Field

4. Repost: Recovering space in SQL Server 6.5

5. Recovering space in SQL Server 6.5

6. trailing spaces on a SQL2000 field

7. trailing spaces on a SQL2000 field

8. VB.NET & SQL Server issue - trailing spaces

9. Getting rid of trailing spaces in VB or SQL

10. User Form - Annoying Extra Space included

11. Project: Retrieving text fields from SQL Server 6.5

12. To many user connections with SQL Server 6.5

 

 
Powered by phpBB® Forum Software