我在命令执行期间遇到了致命错误 [英] I have Fatal error encountered during command execution
本文介绍了我在命令执行期间遇到了致命错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
C# 代码://这里我试图在我的表中插入值.
C# code: //Here i trying to insert values in my table.
case true:
Connection.Connect();
int fk_pic = IdPic();
string insertWork = "INSERT INTO work (fk_id_pic, fk_login, university, lesson, name, info, date_work, price) VALUES (@fk_pic, @fk_login, @university, @lesson, @name, @info, @date_work, @price); Allow User Variables = true;";
MySqlCommand work = new MySqlCommand(insertWork, Connection.Connect());
work.Parameters.AddWithValue("@fk_pic", fk_pic);
work.Parameters.AddWithValue("@fk_login", Program.form1.login);
work.Parameters.AddWithValue("@university", textBox1.Text);
work.Parameters.AddWithValue("@lesson", textBox2.Text);
work.Parameters.AddWithValue("@name", textBox3.Text);
work.Parameters.AddWithValue("@info", richTextBox1.Text);
work.Parameters.AddWithValue("@date_work", DateTime.Now);
work.Parameters.AddWithValue("@ price", textBox4.Text);
work.ExecuteNonQuery();
Connection.Disconnect();
break;
SQL 查询:
CREATE TABLE pic
(
id_pic INTEGER UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'id of image',
caption CHAR(45) NOT NULL COMMENT 'the name of image',
who_add CHAR(30) NOT NULL COMMENT 'who add this image',
img LONGBLOB NOT NULL,
CONSTRAINT pkId_pic PRIMARY KEY(id_pic)
)
COMMENT 'Table for hosting images';
不知道该怎么办.等待回复)
Don't know what to do. Waiting for response)
推荐答案
更改名为name"的列或变量的名称.
Change the name of the column or variable called "name".
name/Name 通常是保留字.
name/Name is usually a reserved word.
这可能是问题所在.
这篇关于我在命令执行期间遇到了致命错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文