Click here to Skip to main content
15,891,981 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi all..

I'm trying pass a DataTable from Class A to Class B [Here I'm using 3-Tier architecture class b is in class library] using properties my code goes like this.


1)public DataTable TYPE_TYRE()

In the above method(1) I'm using to bind the grid to DataTable (working fine)

Case1:-
2)
C#
protected void Test_Click(object sender, EventArgs e)

   {
         Vehicle_Bal ObjB = new Vehicle_Bal();
         ObjB.DtTyre = TYPE_TYRE();
         ObjB.BlTest();

    }

In (2) Button Click I'm Calling (1) assigning it to property from Class A to Class B everything is working fine[Case1 when testing] i could get data in to DataTable property in Vehicle_Bal i.e, class B

##But the problem is occurs when My code is like this in my method.

Case2:-
3)
C#
public void CreateVehicle()
    {
             
        Vehicle_Bal ObjB = new Vehicle_Bal();

        ObjB .PurchaseDt = Convert.ToDateTime(txtPurchaseDate.Text);
        ObjB .WarrentyDt = Convert.ToDateTime(txtWarrentyDate.Text);
        ObjB .MIsc = txtMisc.Text;
        ObjB .VStatus = ddlVStatus.SelectedItem.Text;
       
        (@Mistake)ObjVehicle .DtTyre = TYPE_TYRE();-----------(1)
        (*)ObjB .DtTyre = TYPE_TYRE();-----------(1)


3)----
C#
ObjB .BlCreateVeh();
      }


4) )
C#
protected void btnsave_Click(object sender, EventArgs e)
      {
           CreateVehicle()
      }

In case2 to Upto (*) its is working good, when Im calling (3) i.e method from Class B and Passing the DataTable to Class B I'm not getting any Data

Please any one find out the problem and give me solution to it.
Posted
Updated 12-Mar-14 12:06pm
v4
Comments
Dinesh.V.Kumar 12-Mar-14 7:38am    
Have u declared objVehicle object?

Regards
shashi kiran Jillepally 12-Mar-14 7:56am    
No its typing mistake i have updated it thanks for the reply
Dinesh.V.Kumar 12-Mar-14 7:59am    
Ok what is the error you are getting? Could u post the error message?
shashi kiran Jillepally 12-Mar-14 8:01am    
Hey.. Thanks Dinesh same mistake i have done in my code too

Thanks....
Ganesh Rana <> 12-Mar-14 7:57am    
obj.dtobj = dt.copy();

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900