【发布时间】:2009-05-07 12:10:24
【问题描述】:
我有一个名为 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
为了澄清,如果我编辑一个现有的工作它工作正常,它只是保存失败的新工作。
这是架构:
表创建表
jobs 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) 默认空值,target_temp_extension varchar(10) 默认空值,enabled tinyint(1) 非空值,interval int(11) 非空值,
主键 (id)
) ENGINE=InnoDB AUTO_INCREMENT=7 默认字符集=latin1
【问题讨论】: