SqlConnection mysqlconnection2 = new SqlConnection(str_DotConnection); mysqlconnection2.Open();
string str_SQLtest="insert into YourTableName select * from OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Excel 8.0;HDR=YES;DATABASE=G:\\DotNetApp\\Excel2Sqlserver\\花名册.xls',sheet1$)";
SqlCommand MySQLCommand = new SqlCommand(str_SQLtest, mysqlconnection2); MySQLCommand.ExecuteNonQuery();