我有一张名为jobs的表格,我可以从表格中获取数据但没有问题,但保存会导致问题。下面是代码和错误:为什么我无法使用SubSonic保存数据库事务?
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,
(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,
PRIMARY KEY(id
)
)ENGINE = InnoDB的AUTO_INCREMENT = 7默认字符集= LATIN1
没有探查器,你推荐我用什么? – 2009-05-06 18:59:02
如果你高于版本5.0.37,你可以使用这个: http://dev.mysql.com/tech-resources/articles/using-new-query-profiler.html 从你的模式我猜启用或间隔有一个无效值。 – 2009-05-06 19:40:51
亚当,这就是我想的,但它工作正常,如果我更新和现有的记录,只是不添加一个新的。 – 2009-05-06 23:11:08