Hi guys
I think this is simple question,now Iam frustrated coz i could not find the error.Below I mention the coding I wrote.I Highlighted the text where exception occurs.Exception is "Object reference not set to an instance of an object."(Null ReferenceException)
Pls help me
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog File_Open = new OpenFileDialog();
File_Open.Filter = "Excel Files (*.xls)|*.XLS";
File_Open.ShowDialog();
string path1 = File_Open.FileName.ToString();
Bizz B = new Bizz(path1);
DataSet D1 = B.show_excel();
DataRow[] foundRows;
foundRows = D1.Tables[0].Select("ShopCode IS NOT NULL");
B.T.Columns.Add("SHOP_CODE");
B.T.Columns.Add("SHOP_NAME");
DataRow row = null;
for (int i = 0; i < foundRows.Length; i++)
{
row = B.T.NewRow();
row["SHOP_CODE"] = get_DataValidate(foundRows[i]["ShopCode"].ToString());
row["SHOP_NAME"] = foundRows[i]["ShopName"];
T.Rows.Add(row);
}
public class Bizz
{
public string Path;
public DbConnection dbconn;
public DataTable T;
public Bizz()
{
Path = null;
dbconn = new DbConnection();
DataTable T = new DataTable();
}
public Bizz(string path)
{
Path = path;
DataTable T = new DataTable();
dbconn = new DbConnection();
}
Thanks