0

Hi all,
i'm doing a program using c# in creating an insert page..
i want to insert the zip code into the databse and have been validate using validation expression..

<asp:TextBox ID="txtCmpZip" runat="server" BorderStyle="Groove" MaxLength="10" Width="74"></asp:TextBox><asp:RequiredFieldValidator ID="CmpZip" runat="server" ErrorMessage="*" ControlToValidate="txtCmpZip"></asp:RequiredFieldValidator>
                            <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" TargetControlID="RegularExpressionValidator2"></asp:ValidatorCalloutExtender>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" ErrorMessage="Zip code must at least 5 digits" ValidationExpression="\d{5,10}" Display="None" runat="server" ControlToValidate="txtCmpZip"></asp:RegularExpressionValidator>

when i insert "999999999", it will giving me an error said

error converting data type nvarchar to int.

but for the other zip code, it will insert successfully.. any help plz?

Edited by new SE: n/a

4
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by new SE
0

int..
in the usp also int..it's happens only if i'm insert 9999999999

0

The reason is it's exceeding the size of int.

You can store the data in between -2,147,483,648 to 2,147,483,647

int..
in the usp also int..it's happens only if i'm insert 9999999999

0

i see..
so, is there any validation for that error?
any suggestions?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.