我需要使用存储过程将电话号码插入数据库。但是在插入时会显示以下错误:
SqlException: 将数据类型bigint转换为int时出错。
long phoneNumber = Convert.ToInt64(Phone.Text);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@phone",phoneNumber);
cmd.ExecuteNonQuery();
对于这个参数,DBType是Int64,SQLDbType是BigInt。
我在SQL Server中使用了BigInt作为列的数据类型。
那么问题可能出在哪里呢?
我发现,1999999999[<2^32]可以正确插入,而2999999999[>2^32]不能。
如果您需要更多信息,请告诉我。
谢谢!
int
吗?最近你将其改为了bigint
吗?你是在应用程序运行时进行的更改吗? - shahkalpesh