Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在MYSQL中存储表情符号-列的值超出范围_C#_Mysql - Fatal编程技术网

C# 在MYSQL中存储表情符号-列的值超出范围

C# 在MYSQL中存储表情符号-列的值超出范围,c#,mysql,C#,Mysql,我想在mysql中存储以下表情 Emoticons Score %-( , -1 %-) , 1 (-: , 1 :*( , -1 这是逗号分隔的文件。 我编写以下代码来处理这个文件 private void button1_Click(obj

我想在mysql中存储以下表情

   Emoticons                  Score    

    %-(          ,            -1
    %-)          ,             1
    (-:          ,             1
    :*(          ,            -1    
这是逗号分隔的文件。
我编写以下代码来处理这个文件

private void button1_Click(object sender, EventArgs e)
        {
            string[] lines = File.ReadAllLines("D:\\EmoticonLookupTable.txt");
            foreach (var line in lines)
            {
                var data = line.Split(new[] { ',' }, 2);
                string  Emoticons  = data[0].Trim();
                int Score  = int.Parse(data[1].Trim());

                StoreRecord( Emoticons,Score);
            }
        }     

private void StoreRecord(string word,int Score)
        {
            var conStr = "server=localhost; database=zahid; password=zia; User Id=root;";
            using (var connection = new MySqlConnection(conStr))
            using (var command = connection.CreateCommand())
            {
                connection.Open();
                command.CommandText =
                @"INSERT INTO za 
            (Emoticons,Score) 
          VALUES 
            (@Emoticons,@Score)";
                command.Parameters.AddWithValue("@Emoticons", Emoticons);
                command.Parameters.AddWithValue("@Score", Score);

                command.ExecuteNonQuery();
            }
        }    
但此代码给出以下错误。
错误
第1行“分数”列的值超出范围

感谢您的建议…

您可能试图在数据库的
unsigned int
列中存储负数。

您的代码是正常的(
int
数据类型是有符号整数,所以它支持负数),但您可以在某个地方使用无符号整数

其他原因可能是数字太大

MSDN说:

整数变量存储为有符号32位(4字节)整数 取值范围从-2147483648到2147483647


数据库表中Score列的数据类型是什么?确保Score是有符号的数据类型。MySQL表的结构是什么?请向我们展示您的
描述表za
输出。@rocky:先生,有些表情符号存储在数据库中,但有些并不像x3?那样存储。SQL Server Express与Visual Studio一起使用非常方便。。。我不明白为什么人们在小型应用程序中使用MySQL和.NET。