[英]Why can't I save a database transaction using SubSonic?
我有一个名为Jobs的表,可以毫无问题地从表中获取数据,但保存会引起问题。 这是代码和错误:
Job job = new Job(JobId);
job.Name = txtName.Text;
job.SimsCustCode = txtSimsCustCode.Text;
job.Mode = cboMode.Text;
job.Interval = Convert.ToInt32(nudInterval.Text);
job.Enabled = Convert.ToBoolean(chkEnabled.Checked);
job.SourceHost = txtSourceHostName.Text;
job.SourceType = cboSourceType.Text;
job.SourceUsername = txtSourceUsername.Text;
job.SourcePassword = txtSourcePassword.Text;
job.SourceDirectory = txtSourceDirectory.Text;
job.SourceIgnoreExtension = txtSourceIgnoreExtension.Text;
job.TargetHost = txtTargetHostName.Text;
job.TargetType = cboTargetType.Text;
job.TargetUsername = txtTargetUsername.Text;
job.TargetPassword = txtTargetPassword.Text;
job.TargetDirectory = txtTargetDirectory.Text;
job.TargetTempExtension = txtTargetTempExtension.Text;
job.Save();
这是错误:
A first chance exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'interval) VALUES('adf','adsf','inbound','ftp','','','','','','ftp','','','','','' at line 1
要澄清的是,如果我编辑现有作业,效果很好,那只是保存失败的新作业。
这是模式:
表创建表
作业CREATE TABLE jobs
(
id
int(11)NOT NULL auto_increment,
name
varchar(100)NOT NULL,
sims_cust_code
varchar(10)NOT NULL,
mode
varchar(10)NOT NULL,
source_type
varchar(10)NOT NULL,
source_host
varchar(100)默认为NULL,
source_username
varchar(50)默认为NULL,
source_password
varchar(50)默认为NULL,
source_directory
varchar(100)默认为NULL,
source_ignore_extension
varchar(10)默认为NULL,
target_type
varchar(10)NOT NULL,
target_host
varchar(100)默认为NULL,
target_username
varchar(50)默认为NULL,
target_password
varchar(50)默认为NULL,
target_directory
varchar(100)默认为NULL,
target_temp_extension
varchar(10)默认为NULL,
enabled
tinyint(1)NOT NULL,
interval
int(11)NOT NULL,
主键( id
)
)ENGINE = InnoDB AUTO_INCREMENT = 7 DEFAULT CHARSET = latin1
看起来值没有被正确解析-我需要查看SQL模式以及正在生成的SQL-您是否已启用分析器? 有什么可以让您观察正在发生的事情吗?
间隔是MySQL的保留字:)-您可以输入一个错误吗? 我们应该抓住...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.