我正在使用OLEDB查詢使用日期時間選擇器的Excel文件,但我不斷收到Cireria表達式錯誤中的數據類型不匹配。查詢字符串數據類型不匹配
的日期在Excel中的格式是「2012年6月8日10:00」
DateTime time = dateTimePicker1.Value;
MyCommand = new OleDbDataAdapter("select * from [CR$] where ([Req Start Date] >='" + time + "')", MyConnection);
DtSet = new System.Data.DataSet();
MyCommand.Fill(DtSet);
bindingSource1 = new BindingSource();
bindingSource1.DataSource = DtSet;
bindingSource1.DataMember = DtSet.Tables[0].TableName;
dataGridView1.DataSource = bindingSource1;
MyConnection.Close();
我得到一個錯誤說國有企業不是DATETIME contatin defiitino和使用日期給出了一個錯誤,說沒有找到一個或多個必需參數 – stefan
給定值改變我聲明一點。我看到在添加參數的同時添加值時出現了一些問題。我無法測試這個,所以你可能只是想玩它。 – MikeSmithDev