我尝试使用oleDb
向excel添加数据这是我的代码:
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/Users/shaynaga/Documents/Visual Studio 2010/Projects/requestSystem/requestSystem/dataset.xlsx;Extended Properties='Excel 12.0 xml;HDR=YES;'");
conn.Open();
string sql = "INSERT INTO [Sheet1$] ([Request id],[Request name],[Dua date],[priority]) values(@value1, @value2, @value3, @value4)";
myComm = new OleDbCommand(sql , conn);
myComm.Parameters.AddWithValue("@value1", 1);
myComm.Parameters.AddWithValue("@value2", "bla bla");
myComm.Parameters.AddWithValue("@value3", "10/10/2014");
myComm.Parameters.AddWithValue("@value4", "Low");
myComm.ExecuteNonQuery();
conn.Close();
我不确定为什么会收到错误
任何建议?