该值违反了此列-C#visual studio 2017的最大长度限制 [英] The value violates the maxlength limit of this column -C# visual studio 2017

查看:739
本文介绍了该值违反了此列-C#visual studio 2017的最大长度限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我的sql数据库中有银行表,字段(列)名为'code',长度为4(chr)。

所有银行都在加载的组合框中,并从输入屏幕中选择相关银行。



我从我的报名表中选择银行从组合列表链接到员工主表,其中字段(列)称为银行长度为4(chr)。



所有组合绑定和选择工作



点击保存按钮,它会出错

无法设置列'银行'。该值违反了此列的MaxLength限制。



我的保存按钮代码如下



private void button3_Click(object sender,EventArgs e)

{

this.Validate();

this.masterBindingSource.EndEdit();

this.masterTableAdapter.Update(this.timeattDataSet.master) ;

this.tableAdapterMa nager.UpdateAll(this.timeattDataSet);

this.timeattDataSet.AcceptChanges();

}





请帮帮我



Ajith



我有什么试过:



private void button3_Click(object sender,EventArgs e)

{

this .Validate();

this.masterBindingSource.EndEdit();

this.masterTableAdapter.Update(this.timeattDataSet.master);

this.tableAdapterManager.UpdateAll(this.timeattDataSet);

this.timeattDataSet.AcceptChanges();

}

Hi there ,

I have bank table in my sql database, field(column) called 'code' length is 4(chr).
All banks are in loaded combo box and select relevant bank from entry screen.

I am selecting bank from combo list in my entry form which is linked to employee master table which has field(column) called 'bank' length is 4(chr).

all combo binding and selecting working

when click save button, it give error
"Cannot set column 'bank'. The value violates the MaxLength limit of this column."

my save button code as follows

private void button3_Click(object sender, EventArgs e)
{
this.Validate();
this.masterBindingSource.EndEdit();
this.masterTableAdapter.Update(this.timeattDataSet.master);
this.tableAdapterManager.UpdateAll(this.timeattDataSet);
this.timeattDataSet.AcceptChanges();
}


Please help me

Ajith

What I have tried:

private void button3_Click(object sender, EventArgs e)
{
this.Validate();
this.masterBindingSource.EndEdit();
this.masterTableAdapter.Update(this.timeattDataSet.master);
this.tableAdapterManager.UpdateAll(this.timeattDataSet);
this.timeattDataSet.AcceptChanges();
}

推荐答案

错误消息非常明确:

The error message is pretty explicit:
Cannot set column 'bank'. The value violates the MaxLength limit of this column.

名为 bank 的列已定义为具有特定的最大字符数 - 可能是默认值50 - 你试图插入或更新到数据库的值超过了这个长度。



我们无法解决这个问题:你需要找到一种方法来截断或者限制传递给SQL的数据的长度,或者更改数据库表设计以允许该列中的更长条目。

The column called bank has been defined as having a specific maximum number of characters - perhaps the default 50 - and the value you are trying to INSERT or UPDATE to the DB exceeds that length.

We can't fix that: you need to either find a way to truncate or limit the length of the data you are passing to SQL, or change the DB table design to allow longer entries in that column.


这篇关于该值违反了此列-C#visual studio 2017的最大长度限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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