I get the message "Object reference not set to an instance of an object" when clearing a data table.
Ds.tables["table_name"].Clear();
The datatable exists and it contains data.
Thanks for your help.
I get the message "Object reference not set to an instance of an object" when clearing a data table.
Ds.tables["table_name"].Clear();
The datatable exists and it contains data.
Thanks for your help.
It's about your object not database, you need to check Ds and then Ds.tables["table_name"] to if they are null then call Ds.tables["table_name"].clear();
Add condition
if(Ds.tables["table_name"]!=null){
Ds.tables["table_name"].Clear();
}
OR
if(Ds.tables["table_name"]!=null){
Ds.Rows.Clear();
}