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)
{
}
自己传sql语句
先获取,在写sql
网上找c# 数据库 CURD操作