hi

I have filled my datasetfrom my sql db then used that data to show at crystal report, when i go back again to fill it with another data it show to me the old one why ? how can i solve this problem ??

Best Regards

if i have this code :

public static DataSet ds = new DataSet();

 if ( Convert.ToInt32(SelectedRow.Cells[1].Value).Equals(2))
            {
                flag = 2;
                SQLSelectStatment = "SELECT * FROM News_Agency WHERE ID=" + (SelectedRow.Cells[0].Value).ToString();

                try
                {
                    SqlCommand sqlCMD = new SqlCommand(SQLSelectStatment, conn);
                    sqlCMD.CommandType = CommandType.Text;

                    SqlDataAdapter adp = new SqlDataAdapter(sqlCMD);

                    adp.Fill(ds);
                    ds.Tables[0].TableName = "SelectNewsAgency";
                }
                catch (Exception exp)
                {
                    throw new ArgumentException(exp.Message);
                }
                finally
                {
                    conn.Close();
                }
            }

how can I do (MyTableAdapter.ClearBeforeFill = true;) in this code ???

best regards

I have solved this problem with two rows of code :

ds.Reset();
adp.Fill(ds);
ds.Tables[0].TableName = "SelectNewsAgency";
ds.AcceptChanges();

with Reset() & AcceptChanges()
Thanks for every one

Best Regards

This question has already been answered. Start a new discussion instead.