• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to limit number of chars in a CFGRIDCOLUMN

New Here ,
Jun 06, 2006 Jun 06, 2006

Copy link to clipboard

Copied

Hi,

I have a 2 column grid populated from a query. The grid is editable and will be submitted to an action page for database Delete, Insert, or Update. The first grid column corresponds to a MS SQL database column that is defined as varchar(3).

Currently, if the user inputs 4 characters and submits, I get a SQL trunc error.

There has to be a way to limit the number of characters in this cfgridcolumn to 3? How is it done?
TOPICS
Advanced techniques

Views

285

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 06, 2006 Jun 06, 2006

Copy link to clipboard

Copied

Well, you could check the number of characters on your action page, and bounce them back if it exceeds the maximum number, and you can "protect" the database by including a limiting function on the data in the insert statement, like LEFT(col, 3) so that regardless what they specify, you will only insert the first 3 into the database. You really should let them know if they entered too many, however.

Phil

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 06, 2006 Jun 06, 2006

Copy link to clipboard

Copied

LATEST
Thanks.

I thought of doing it on the server like that. If I'm going to bounce them back I'd want to find a way to preserve the changes they made.

I was hoping there was a way to simply prevent the entry of a 4th char in the first place.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation