? string path=File.ReadAllText(fileupload.FileName);
String strConnection = "Data Source=Sourcename-30;Initial Catalog=catalogname;User ID=sa;Password=abc25;";
string fullPath = System.IO.Path.GetFullPath(fileupload.FileName);
string file = System.IO.Path.GetFileName(fullPath);
string dirPath = System.IO.Path.GetDirectoryName(fullPath);
string excelConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source= \"" + dirPath + "\\\";" + "Extended Properties=\"text;HDR=YES;FMT=Delimited\"";
OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
excelConnection.Open();
OleDbCommand cmd = new OleDbCommand("Select * from [" + fileupload.FileName +"]", excelConnection);
OleDbDataReader dReader = cmd.ExecuteReader();
Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator