条件expression式中的OleDb数据types不匹配

我目前正试图写入一个Excel文件。 我使用这段代码:

public void UpdateExcelFile(string dir, string sheet, string sql) { System.Data.OleDb.OleDbConnection MyConnection; System.Data.OleDb.OleDbCommand myCommand = new System.Data.OleDb.OleDbCommand(); MyConnection = new System.Data.OleDb.OleDbConnection(String.Format("provider=Microsoft.Jet.OLEDB.4.0;Data Source='{0}';Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=0;MAXSCANROWS=0\";", dir)); MyConnection.Open(); myCommand.Connection = MyConnection; myCommand.CommandText = sql; myCommand.ExecuteNonQuery(); MyConnection.Close(); if (myCommand != null) { myCommand.Dispose(); myCommand = null; } if (MyConnection != null) MyConnection.Dispose(); } 

我遇到了“标准expression式中的数据types不匹配”exception。 我的发言如下:

 string cmdString = String.Format("Insert into [{0}] (Customer, Location, CalendarWeek, from, till, [agreed at], [agreed with], [{1}]) values('{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')" , sheetName, getPackaging.Text, getCustomer.Text, getLocation.Text, getCalWeek, getFirstDayOfCalWeek, getLastDayOfCalWeek, getDateOfAgreement.Value.ToString("dd/MM/yyyy"), getNameForPrice.Text, getPrice.Value.ToString()); 

所以一切都转换为string。 在我的Excel文件中,我将每一列转换为“标准”。 为什么会这样呢? 我甚至有MaxScanRows属性设置为0。

编辑:这是cmdString

 Insert into [Sheet1$] (Customer, Location, CalendarWeek, from, till, [agreed at], [agreed with], [10x500]) values('A','City','1','02.01.2016','08.01.2016','05.03.2016','Test','3')