Getting white space (square character) in database

We have a VC++/MFC application.  Our users are sporadically getting a 
non-printable square character in their database record fields.  The data is 
typically collected through the UI in a text field.

For example, we have a field for suffix.  In the database, "[]r" was stored 
instead of "Jr".

I don't know what the users could be doing to get this.  I am guessing it 
might be that they are accidently hitting additional keys like the control 
key on the keyboard and creating the non-printable characters.

Any ideas?

Rob C
0
RobC (20)
4/4/2005 2:41:02 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
591 Views

Similar Articles

[PageSpeed] 48

YES - Validation!

Don't put any data into a database without first validating it.
Besides checking for printable characters, you should also handle the 
single-quote (apostrophe), either removing it, rejecting the input until 
corrected, or (as I do) replacing all "'" with "''", which will then 
pass through the SQL parser and be stored as "'".

My watchword for users is that if there's a way to screw up an 
application, they will find it, or, if necessary, create it.

Don't leave it in their hands.

Balboos

Rob C wrote:

> We have a VC++/MFC application.  Our users are sporadically getting a 
> non-printable square character in their database record fields.  The data is 
> typically collected through the UI in a text field.
> 
> For example, we have a field for suffix.  In the database, "[]r" was stored 
> instead of "Jr".
> 
> I don't know what the users could be doing to get this.  I am guessing it 
> might be that they are accidently hitting additional keys like the control 
> key on the keyboard and creating the non-printable characters.
> 
> Any ideas?
> 
> Rob C
0
4/4/2005 4:07:29 PM
Thanks Ballboos,

Do you have any idea what key sequence could be causing the square box 
character?

Thanks,

-Rob

"Balboos" wrote:

> YES - Validation!
> 
> Don't put any data into a database without first validating it.
> Besides checking for printable characters, you should also handle the 
> single-quote (apostrophe), either removing it, rejecting the input until 
> corrected, or (as I do) replacing all "'" with "''", which will then 
> pass through the SQL parser and be stored as "'".
> 
> My watchword for users is that if there's a way to screw up an 
> application, they will find it, or, if necessary, create it.
> 
> Don't leave it in their hands.
> 
> Balboos
> 
> Rob C wrote:
> 
> > We have a VC++/MFC application.  Our users are sporadically getting a 
> > non-printable square character in their database record fields.  The data is 
> > typically collected through the UI in a text field.
> > 
> > For example, we have a field for suffix.  In the database, "[]r" was stored 
> > instead of "Jr".
> > 
> > I don't know what the users could be doing to get this.  I am guessing it 
> > might be that they are accidently hitting additional keys like the control 
> > key on the keyboard and creating the non-printable characters.
> > 
> > Any ideas?
> > 
> > Rob C
> 
0
RobC (20)
4/4/2005 5:07:01 PM
It depends upon the font you use.  Windows substitutes a square 
character for those not available in the current font.  This should give 
you some interesting options for damage already done:

View the output of the saved-squares data with various fonts - one of 
them may be a hit - but this approach is really just playing around.

One other thing you can do to force users not to screw up:  for a field 
like name suffix, you can give them a pick-list instead of letting them 
fill it in.  Then they can't mess it up (don't forget to allow for a 
blank, and make it the default after each save).

Balboos

Rob C wrote:
> Thanks Ballboos,
> 
> Do you have any idea what key sequence could be causing the square box 
> character?
> 
> Thanks,
> 
> -Rob
> 
> "Balboos" wrote:
> 
> 
>>YES - Validation!
>>
>>Don't put any data into a database without first validating it.
>>Besides checking for printable characters, you should also handle the 
>>single-quote (apostrophe), either removing it, rejecting the input until 
>>corrected, or (as I do) replacing all "'" with "''", which will then 
>>pass through the SQL parser and be stored as "'".
>>
>>My watchword for users is that if there's a way to screw up an 
>>application, they will find it, or, if necessary, create it.
>>
>>Don't leave it in their hands.
>>
>>Balboos
>>
>>Rob C wrote:
>>
>>
>>>We have a VC++/MFC application.  Our users are sporadically getting a 
>>>non-printable square character in their database record fields.  The data is 
>>>typically collected through the UI in a text field.
>>>
>>>For example, we have a field for suffix.  In the database, "[]r" was stored 
>>>instead of "Jr".
>>>
>>>I don't know what the users could be doing to get this.  I am guessing it 
>>>might be that they are accidently hitting additional keys like the control 
>>>key on the keyboard and creating the non-printable characters.
>>>
>>>Any ideas?
>>>
>>>Rob C
>>
0
4/4/2005 8:04:37 PM
Actually, ctrl-J will most likely display as a blot, a thick vertical bar, rather than an
open square box. 

If you are curious what the characters are, I would suggest doing a GetWindowText on the
input field control and examining it with a debugger, or displaying it in some way as hex
data.

The problem is that you don't know what is stored in the database; you only know what is
displayed in your control. This could be an error in the input, an error in the store
intot he database, an error in the retrieval from the database, or an error in the setting
of the text in the control. Until you know where the problem is, it is going to be hard to
solve it.

As already answered, you should make sure that only legal data is stored in the database.
It doesn't hurt in a case like this to make sure that when you get the data back, it is
still legal, long before you get around to displaying it.
				joe
On Mon, 4 Apr 2005 07:41:02 -0700, "Rob C" <RobC@discussions.microsoft.com> wrote:

>We have a VC++/MFC application.  Our users are sporadically getting a 
>non-printable square character in their database record fields.  The data is 
>typically collected through the UI in a text field.
>
>For example, we have a field for suffix.  In the database, "[]r" was stored 
>instead of "Jr".
>
>I don't know what the users could be doing to get this.  I am guessing it 
>might be that they are accidently hitting additional keys like the control 
>key on the keyboard and creating the non-printable characters.
>
>Any ideas?
>
>Rob C

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
4/4/2005 9:17:40 PM
Reply:

Similar Artilces:

Send/Receive message
Hi. When my Outlook 2003 Send/Receive progress window appears, it used to have an indicator showing the number of messages downloaded out of a total number to be downloaded. This does not appear now, can someone tell me how I activate this feature again? The window still appears with the Send/Receive ISP names but not the number of messages etc. Thanks. Griff. ...

Why am I getting a #VALUE! Error?
Previously I had this formula which was working fine: =IF(AND(OR($E$5=1,$E$5=2),$E$2="...3/12...",$E$3=" inch"),VLOOKUP($E$6,lookup!$C$3:$D$19,2,0),IF(AND($E$5=3,$E$2="...3/12...",$E$3=" inch"),VLOOKUP($E$6,lookup!$E$3:$F$19,2,0),"")) But after I add another part onto the end of the formula I am no getting a #VALUE! error (even though, if I enter information in th referenced cells, it seems to work fine and return the correc numbers): =IF(AND(OR($E$5=1,$E$5=2),$E$2="...3/12...",$E$3=" inch"),VLOOKUP($E$6,lookup!$C$3:$D$19...

Need to run Access 97 database with Access 2007
I have 8-10 office users using Access 97 database (with .mdw security) and a new machine with Access 2007 . . . when attempting to open the 97 database I get permission errors that are confusing. . .is it possible to run and leave intact the 97 database with the 2007 program until I get the 97 users upgraded and convert the database? Thanks ...

Form to search database and return found records
In my Windows XP Access 2003 database (with 4 tables) I need a 'search form' where I can enter values (corresponding to different tables) in the top half of the screen and have matching records returned in the bottom half of the screen. I have been able to create a form for the top half, and another one for the bottom half. I am able to enter filter criteria in the top successfully (i.e., debug.print returns the correct filter string). However, I do not know how to link the filter to the sub-form at the bottom. I have gone through similar posts/solutions, but am still having prob...

RMS Admin Points to incorrect database
Hello, Our customer accidentally has RMS points to the incorrect Database, they had the store points to the TEST instead of PRODUCTION database. Now, 3 days worth of transactions & changes are being made into the TEST db. Is there a proper way to copy all the changes over to the correct PRODUCTION db? Any help is greatly appreciated. Many Thanks, There is no good way to transfer a date chunk from one database to another. Your best solution is to recreate all the activity from those days onto the production database. You could set the date back to those days on the terminal and...

Getting form expression results to update to table.
The totals from the expressions in a couple fields on the form don't update to the table. They (the expressions) work correctly in the form, but they (the results of the expressions) don't appear on the table after clicking Update All. Does anyone know how ot fix this? Hi Peg, First, forms don't contain fields. They contain controls (most commonly textboxes) which may or may not be bound to fields in the form's recordsource. If they are bound to a field, changing the data in the form will change the underlying field in a table (unless the form's recordsource ha...

How can I get more colors in the RECOLOR option?
When I am recoloring a picture in PPT 2007, it only gives me a handful of options as to what colors to choose from. I ran across an internet article that showed an option for More Variations, and it looks like you can choose the exact color you would like, similar to choosing a fill color on an object. How do I do this, when I don't have this option? Here is the internet article: http://www.ellenfinkelstein.com/powerpointtips/powerpoint_tip_recolor_graphics_2007.html Are you saying you don't see "more variations" and "set transparent color" below th...

All cell contents within a range of cells turns white if Sheet1!A1 = 1
If the return of Sheet1!A1 = 1, I need all fill, font and line colors to turn white from A1:E10. If the value of Sheet1!A1 changes to 0, all colors must return to normal. Does anyone have any thoughts on this? Thanks for any suggestions. Michael If your range to format is on Sheet1............. Conditional Formatting Select A1:E10 Format>CF>Formula is: =$A$1=1 Format to suit If range to format is on a sheet other than Sheet1 Select Sheet1!A1 and give it a name..............insert>name>define On other sheet select range A1:E10 and Format>CF Form...

How to Control a formula by a character in adjacent column on same
I have the following example A 1 aaa 1 2 aaa 2 3 bbb 3 X 4 ccc 4 5 ccc 5 6 3 7 3 8 9 Cell A1 contains "aaa" Cell B1 contains "1" Cell D3 contains "X" Formula in B6 is =SUMIF(A1:A5,"A",B1:B5) and returns 3 Formula in B7 is =SUMIF(A1:A5,"B",B1:B5) and returns 3 Formula in B8 is =SUMIF(A1:A5,"C",B1:B5) and returns 9 I want to be able to add a function that will allow me to control the formula by whether there is an X on the same row a cople of columns over. So if I pu...

Cant get rid of large bottom margin when printing
I cannot stop large unprintable borders around the edge of an A4 page. Have adjusted settings in wordpad and in margins. New settings say the only border should be 0.01cm at the bottom. This has made no difference. Border is much larger at the bottom than the other sides. Any help gratefully received. That could be a limitation of your printer. Check your owner's manual. -- JoAnn Paules MVP Microsoft [Publisher] "Fangfur" <Fangfur@discussions.microsoft.com> wrote in message news:B3BB0A9B-0FC4-439C-9809-2FCEBD6E6E4D@microsoft.com... >I cannot stop large unprint...

XMLTextWriter and decoding special characters.
Hello Everyone, I have written a simple app. that converts the dataset into excelspreadsheet. The App. uses the following architecture. First it generates the dataset with corresponding datatables(each datatable represents a worksheet).It uses an Xslt file to do the transformation of the xml (generate from dataset) and write the output xml into a xmltextwriter. The App converts the data into excel with almost all of the formatting as desired with exception of few. "In order to display a STRING VALUE into MULTIPLE ROWS WITH IN A CELL Excel uses a value &#10;" I am aware that...

Get workbook version
I have a workbook that needs to be updated fequently and i need to know the version of the workbook in the code in order to copy and replace newer versions. I tought of insering a 'Version' property in the 'personalisation' panel that is in the property of the file itself. But i can't seem to be able to get the value of this property in the code. The code would be in a delphi program or in a macro in the workbook , i could use both methods. If you have any idea or research keywords that could help me plz tell me ! thanx ! chriss Hi and again :-) see your answer in Excel...

How to make distribution list from database.
Hi. I have a database containing 3000 members. Every week we send a mail to all members - this is done manually. Is it possible to extract the mail address from the database and put them in a distribution list, witch we can send our newsletter to. My thought is that this can be an automatic process. Regards Morten. A query based DL could do the job. "morten" wrote: > Hi. > > I have a database containing 3000 members. Every week we send a mail to > all members - this is done manually. Is it possible to extract the mail > address from the database and put them...

Close Database Function?
I want to use task scheduler to open an Access DB, run a macro that updates a table from an external source, then close the DB and Access. I do not use any forms on this database, just one table and one macro. So I guess my needs are as follows: 1. Automatically execute 'My_Macro' when the DB is opened from Task Scheduler. My Scheduled Task uses the /X switch to specify and execute the Macro - my main problem is determining how to programatically close the DB and Access. I would like to continue using the command line method of executing the macro if possible so that I can m...

Get text from anather application
want to get to copy or get the selected text from internet explorer i use this code to get the hWnd HWND FgHwnd=GetForegroundWindow(); DWORD lpdwProcessId; DWORD td=GetWindowThreadProcessId(FgHwnd,&lpdwProcessId); AttachThreadInput(td,GetCurrentThreadId(),TRUE); HWND awnd=GetFocus(); and then i use SendMessage to copy the text char buffer[256] = {0}; SendMessage(awnd, WM_COPY,255, (LPARAM)&buffer); its works fine if the application has a simple edit or rich edit box. but i when i want to get the text from internet explorer it doesnt work. Please help me natanr123@vfem...

single-spacing for linebreaks
Version: 2004 Operating System: Mac OS X 10.5 (Leopard) Word is forcing double-spaced linebreaks on me� <br><br>I'm a poet, and I want SINGLE-SPACED linebreaks, <br><br>but I can't figure out how to change what Word is defaulting on me� In Word 2004 you can put a tool onto the toolbar that toggles between 12 point and 0 point space-before-paragraphs. It is called OpenOrCloseUpPara and can be found in the customise toolbars/menus command under commands. Drag it to a convenient part of the toolbar. <br><br>But for all my Poetry I use a soft retur...

How do I get text effects in excel like those available in word
In MS Word you can get text effects under "Format" "Font" I want to do the same in excel - any suggestions please? I would also like to conditionally format an excel formulae to give an "effect" if it did not meet a given criteria - Conditional formatting does not provided "Text Effects" Thanks It does. Condiitional formatting providet COLOR effects. Conditional Formatting > click Format Button > select Color for formatting. -- Manatee ------------------------------------------------------------------------ Manatee's Profile: http://www....

How do I get picture files into Excel and complete mail/catalog me
I have set up my Excel database with "Name field" and "Picture field" but cannot get the picture to show up in MSPub 2003 publication. I typed the path to the picture in the "picture field" and when I "view results" or "complete the merge" ... the "path" is all that shows where the image should be. What am I doing wrong? Robert <Robert@discussions.microsoft.com> was very recently heard to utter: > I have set up my Excel database with "Name field" and "Picture field" > but cannot get the pictur...

Web form that drops into access database
I want to do something that I feel is very simple; however, I have no knowledge of how to do it. I want to have a form on a website that drops the data from the form into an access database. I have a decent amount of experience with web design, and would just like somewhere to start. Any help would be greatly appreciated. Thanks, Michael <mgreer65@gmail.com> wrote in message news:e6a7c688-272b-4219-8241-74c3e3e7b2a2@e25g2000prg.googlegroups.com... >I want to do something that I feel is very simple; however, I have no > knowledge of how to do it. I want to have a form on a w...

Mail Login Problems
I have COMCAST Broadband. Windows ME. When I launch IE browser, home page set to Comcast.net, page comes up, then I log in for mail, login page appears missing all links for mail, pictures, etc., and status bar a bottom sits half way, trying to load this info. Click on links, and it bounces all over the place. Called COMCAST 3x. Went thru all settings, reestablished passwords. No luck. COMCAST says it OS problem. What? Lucky for me I can get to my COMCAST mail at work. Thanx Jean <anonymous@discussions.microsoft.com> wrote: > I have COMCAST Broadband. Windows ME. When I ...

Simple hack to get $500 to your home. 06-02-10
Simple hack to get $500 to your home at http://dailyupdatesonly.tk Due to high security risks,i have hidden the cheque link in an image. in that website on left side below search box, click on image and enter your name and address where you want to receive your cheque.please dont tell to anyone. ...

oops... Getting product name from other sheet
Which formula can I use to get product names to transfer onto other sheets? Like: Sheet1: ITEM# NAME T0589 Rose T0575 Lilly T0575 Tulip Sheet2: ITEM# NAME T0589 T0575 I would like for it to recognize the item# in sheet to and automatically look for the product name from sheet 2 and fill it in. I tried a few "IF" formulas, but w/out luck. Thanks for any help... -- Nicki Taylor =vlookup() looks like it would work ok. =if(a1="","",vlookup(a1,sheet2!a:b,2,false)) You may want to read Debra Dalgleish's notes: http://www...

Database Queries with database views, that base on many database t
I created 2 database views. Each of them uses 256 database tables. From every database table only one column is used in the select list of the view. Every database table has one column which is used for the join. Each database table has 5 rows. The database tables have not any foreign keys and indexes. Both views works fine. When I use the database views in a query like this: SELECT v1.*, v2.* FROM v1, v2 WHERE v1.id=v2.id I should get 5 rows with 512 columns in the resultset. But I get the following error from the SQL-Server (after about 5 minutes): Msg 8621, Level 17, State 2...

How can 4 comps get mssgs from one address + one unique each??
Hi- We are a small office with 4 computers. We want to configure Outlook on each so that each receives email from our general office account as well as one unique account apiece. In other words, each computer receives from two accounts.... Can we configure it this way? We have tried to do so but keep having problems with a particular computer. It lists each account (one general office + one unique), but doesn't seem to receive messages from the general account, or only does so sporadically. Is this an issue with the account settings? Any help, suggestions woul...

Show alternate or different characters
I have a column that contains Social Security numbers. I would like this column to display the numbers as 'xxx-xx-1234'. I can't seem to be able to figure out how to do this. Cell formatting doesn't tell really say about a 'replacement' character. Select the column Click Format > Cells > Special > Social Security Number Click OK -- Rgds Max xl 97 --- GMT+8, 1� 22' N 103� 45' E xdemechanik <at>yahoo<dot>com ---- "Greg Hill" <Greg Hill@discussions.microsoft.com> wrote in message news:D654E9DC-9EB2-41D0-BAC5-F8EA7F3303B...