为什么我不能使用SubSonic保存数据库事务?

时间:2009-05-06 15:19:03

标签: c# 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

为了澄清一点,如果我编辑现有的工作,它工作正常,它只会保存失败的新工作。

这是架构:

表创建表


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)默认为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

1 个答案:

答案 0 :(得分:1)

看起来似乎没有正确解析值 - 我需要查看SQL模式以及正在生成的SQL - 您是否有分析器?什么能让你看到发生了什么?

Interval是一个MySQL保留字:) - 你能输入一个bug吗?我们应该抓住那个......