我正在尝试将电话号码发送到表中,这样显示错误 [英] i am trying to send phone number into table its showing error like this

查看:63
本文介绍了我正在尝试将电话号码发送到表中,这样显示错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将电话号码发送到表中,显示错误是这样的



varchar值'1234567890'的转换溢出了一个int列。

声明已被终止。

plz给我解决方案.....

i am trying to send phone number into table its showing error like this

The conversion of the varchar value '1234567890' overflowed an int column.
The statement has been terminated.
plz give me solution.....

推荐答案

你采取了int类型数据库中的列。

并且您提供的数字不是'1234567890',它大于int的大小。

i将更喜欢更改该列 int 输入十进制(12,0)或者如果你想添加标志那么

将其设为 nvarchar(12)
You have taken int type column in database.
and you providing no as '1234567890' which is bigger than size of int.
i will prefer to change that column int type to decimal(12,0) or if you want to add signs then
make that as nvarchar(12)


你不应该在.NET或SQL Server中使用那个电话号码溢出一个int - 一个int可以容纳-2,147,483,648和2,147,483,647之间的任何数字。

访问有一个较小的范围,所以这取决于你的数据库。



但是,电话号码不应该存储在数字字段中:你不能用它算术(什么是你的手机号码加我的电话号码? - 垃圾,就是这样!)

如果您使用数字字段,则会丢失前导零,国际符号和可选括号/分机号码。



使用基于字符串的商店获取电话号码 - 这就是为什么数据的保存完全符合用户提供给你的原因!
You shouldn't overflow an int in .NET or SQL Server with that "phone number" - an int can hold any number between -2,147,483,648 and 2,147,483,647.
Access however has a smaller range, so it depends on your DB.

However, a phone number should not be stored in a numeric field: you can't do arithmetic with it (What is "Your phone number" plus "My phone number"? - rubbish, that's what!)
And if you use a numeric field you lose leading zeros, international symbols and optional brackets / extension numbers.

Use a string based store for phone numbers - that why the data is preserved exactly as the user gave it to you!


这篇关于我正在尝试将电话号码发送到表中,这样显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆