Try this below code on button import click
protected void btnImport_Click(object sender, EventArgs e)
{
if (!FileUpload1.HasFile)
{
try
{
string path = string.Concat(Server.MapPath("~/Uploaded Folder/" + FileUpload1.FileName));
FileUpload1.SaveAs(path);
string excelConnectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=Excel 8.0", path);
OleDbConnection connection = new OleDbConnection();
connection.ConnectionString = excelConnectionString;
OleDbCommand command = new OleDbCommand("select * from [Sheet1$]", connection);
connection.Open();
DbDataReader dr = command.ExecuteReader();
string sqlConnectionString = @"Data Source=MYPC;Initial Catalog=Student;User ID=sa;Password=wintellect";
SqlBulkCopy bulkInsert = new SqlBulkCopy(sqlConnectionString);
bulkInsert.DestinationTableName = "Student_Record";
bulkInsert.WriteToServer(dr);
Label1.Text = "Ho Gaya";
}
Catch(Exception ex)
{
label.text=ex.Message.ToString();
}
}