Click here to Skip to main content
15,908,444 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I AM developing the application using WPF VS 2010

in this application

Datatable.Rows.Clear() function is take more time in execution..

How To Reduce the execution time and how to increase the performance
Posted

1 solution

You can always look at clearing one row at a time rather than clearing up all together.
Have a look at the Delete() method[^].
 
Share this answer
 
Comments
Member 10186770 7-Aug-13 3:30am    
private void Delete_Click(object sender, RoutedEventArgs e)
{
if (DL.Text == FN.Text)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=SANAKIYAN-PC;Initial Catalog=ApplicationBase;User Id=sa;Password=softwaretech";
con.Open();
DataTable dt = new DataTable("Base");
SqlCommand cmd = new SqlCommand("delete from Base where FirstName='"+DL.Text+"'", con);
SqlDataAdapter da=new SqlDataAdapter(cmd);
dt.Rows[1].Delete();
dt.AcceptChanges();
con.Close();
}
}
Member 10186770 7-Aug-13 3:32am    
is this a correct a way to delete a row which is in gridview in wpf...is there any other solution to delete a record or row from the table through gridview in wpf..

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