数据截断列第1行 [英] Data Truncated For Column row 1

查看:119
本文介绍了数据截断列第1行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public void pripass2()
        {
            float  b = 0.5f;
            float  c;
            ppass = Convert.ToSingle (label19.Text);
            try
            {
                if (ppass > 0 && checkBox5.Checked == true)
                {
                    ppass--;
                    label19.Text = ppass.ToString();
                    cmd = new MySqlCommand();
                    cmd.CommandText = "update emppassdetails set activepass='" + label19.Text + "'";
                    cmd.Connection = con;
                    cmd.ExecuteNonQuery();

                }
                else if (ppass > 0 && checkBox5.Checked == false)
                {
                    c = ppass - b;
                    label19.Text = c.ToString();
                    cmd = new MySqlCommand();
                    cmd.CommandText = "update emppassdetails set activepass='" + label19.Text + "'";
                    cmd.Connection = con;
                    cmd.ExecuteNonQuery();

                }
            
            }
            catch (Exception ex)
            {
                MessageBox.Show("Please Call Anurag"+ex.Message );
            }
        }





这里PPASS IS全局声明,其他变量是本地的但是ifif语句给出了错误, if语句工作正常

数据截断第1行的列activepass



Here PPASS IS declared globally and other variables are local but elseif statement is giving error and if statement is working fine
Data Truncated for column activepass at row 1

推荐答案

嗨朋友你应该看看这个,



hi friend you should read this,

The problem is that those empty values are interpeted as empty strings (''), not as NULL values. 

To force a NULL value into those fields you can change your text-file and use the escape character "\N".





http://stackoverflow.com/questions/1704304/what-is-this-error-database-query-failed-data-truncated-for-column-column-na [ ^ ]





http://dba.stackexchange.com/questions/4091/data-truncated-for-column [ ^ ]



见此示例:





http://stackoverflow.com/questions/1704304/what-is-this-error-database-query-failed-data-truncated-for-column-column-na[^]


http://dba.stackexchange.com/questions/4091/data-truncated-for-column[^]

see this Example:

mysql> create table a (a float not null);
Query OK, 0 rows affected (0.11 sec)

mysql> insert a values ('');
Query OK, 1 row affected, 1 warning (0.05 sec)

mysql> show warnings;
+---------+------+----------------------------------------+
| Level   | Code | Message                                |
+---------+------+----------------------------------------+
| Warning | 1265 | Data truncated for column 'a' at row 1 |
+---------+------+----------------------------------------+
1 row in set (0.00 sec)

mysql> set sql_mode = 'STRICT_ALL_TABLES';
Query OK, 0 rows affected (0.02 sec)

mysql> insert a values ('');
ERROR 1265 (01000): Data truncated for column 'a' at row 1





问候

sarva



regards
sarva


数据截断列(例如:id)错误:

答案:检查您的数据类型天气它支持Varchar()



问候

SHEIK ANAS
Data Truncate for the column (eg: id) error :
Answer: Check Your Data Type weather it support Varchar ()

Regards
SHEIK ANAS


这篇关于数据截断列第1行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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