Aarthi Ramani

Aarthi Ramani

  • NA
  • 2
  • 1.9k

Method or operation is not implement. what shall i do ?

Feb 21 2013 2:06 AM
This program I need to browse and upload the excel file into database using asp.net web application program. In that method or operation is not implement when i run that program. what shall i do?

{
string SaveLocation = Server.MapPath("Data");
if (!Directory.Exists(SaveLocation))
{
Directory.CreateDirectory(SaveLocation);
}
if (!SaveLocation.EndsWith("\\"))
{
SaveLocation = SaveLocation + 
"\\emp.xlsx";
}
else
{
SaveLocation = SaveLocation + 
"emp.xlsx";
}
FileUpload1.SaveAs(SaveLocation);
if (!String.IsNullOrEmpty(FileUpload1.PostedFile.FileName))
{
empservice objempservice = new empservice();

string excelConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + SaveLocation + ";Extended Properties=Excel 12.0";
OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
excelConnection.Open();
OleDbCommand cmd = new OleDbCommand("Select * from[Sheet1$]", excelConnection);
OleDbDataReader dReader;
dReader = cmd.ExecuteReader();
bool isValid = true;
string vehicleNotFound = String.Empty;
string noVehicleAssigned = String.Empty;
while (dReader.Read())
{
string vehicleRegNo = dReader["RegNO"].ToString();
string empId = dReader["EmpID"].ToString();
if (String.IsNullOrEmpty(vehicleRegNo) == false)
{
bool IsVehicleFound = objempservice.IsVehicleFound(vehicleRegNo);
if (IsVehicleFound == false)
{
vehicleNotFound = vehicleNotFound + 
"," + vehicleRegNo;
IsVehicleFound = 
false;
isValid = 
false;
}
}
else
{
if (String.IsNullOrEmpty(empId) == false)
{
}
}
}
}
}

Answers (1)