第1个回答 2017-11-17
string filepath = "d:\\signup.xlsx";
string strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";
OleDbConnection conn = new OleDbConnection(strCon);
OleDbCommand comm = conn.CreateCommand();try
{
conn.Open();
string qry = string.Empty;
qry = "insert into [Sheet1$] values(1,2)";
comm.CommandText = qry;
comm.ExecuteNonQuery();
}
catch (Exception e)
{
}本回答被网友采纳