Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL
Expertise: Beginner
Mar 24, 1997

Column lengths

Question:
Data field objects in OPO can accept any amount of data, but if I send too many characters to the server, I get an error "flushing the row to the database". How come?

Answer:
Cause that's the way it is?

In OPO, the connection between the database and the field bound to the database is only somewhat logical. The error being returned is the database complaining that it has received data that is too long.

There are two basic ways to address this. The first is to check the lengths of the values being sent to the database before committing the row or flushing to row to the database by moving to a container bound to a different table source, such as with the ChgCurrentRow() method. This will work fine, but the user will not find out that there is a problem until they go and send the row to the database.

The second way to address this problem is to use the OnKey() method to accept and count the characters as the user enters them. You could then pop a message box and let the user know that the data was too long. You can find a more details on using the OnKey() method in another questions in this section about hiding characters in a password field.

Since you would want to have this functionality in a lot of data fields, you could create a user class and use instances of it whenever you wanted to limit the number of characters that a user can enter.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date