This is my code and it runs but when i click the import button it Gives me the error "Object reference not set to an instance of an object."
i don't know what the problem is plz help.i did add the microsoft.office.interop.excel reference.
using
using System.Collections.Generic;
namespace
{
InitializeComponent();
}
studentdal = studObj;
envChecker = EnvChecker;
ExcelObj =
System.Windows.Forms.
ExcelObj.Visible =
lblResults.Visible =
btnImport.Enabled =
lblResults.Text =
ImportToStudent();
Microsoft.Office.Interop.Excel.
conPSAtechZ.ConnectionString = connection;
System.Data.
commandExcel.CommandText =
conPSAtechZ.Open();
studentdal.RegisterStudents(
commandExcel.CommandType =
dr.Close();