StrataFrame Forum

Using FillDataTable method

http://forum.strataframe.net/Topic7931.aspx

By Vikram Saxena - 4/6/2007

Hi,



i am showing some data in a grid present in the form.

i want user can modify the customers in grid and also can add new.

lets say i have customers.



so what is do is.

//in the BO

public Datatable GetExistingCustomers()

{

return GetByStoredProcedure("proc_GetCustomers");

}



//in the form

DataTable dtCustomers = customerBO1.GetExistingCustomers();

gridCustomer.DataSource = dtCustomers;



now i want to use fill the BO i use on my form with same records as i am showing in the grid.

please tell me how can i do this.

should i need to use the CopyDataFrom() function. i tried this but when i use

customerBO1.NewRow() i got exception "The given key was not present in the dictionary.".



am i missing some thing??...please give me any solution..
By Trent L. Taylor - 4/6/2007

Well I think that you are going about this in a more difficult way than you need to.  I would use a BusinessBindingSource control, Fill by business object and just bind it to the grid.  There is a sample that comes with the framework named the BusinessBindingSource Sample (I think).  I know that it is on the first page of the Sample Console.  I recommend looking at this sample, I think it will help you as you move forward.