How to save changed datagrid data??

csharp , db Norman, United States
  • 9 years ago

    Hi guys...

    After I write the private void Bindsequence function.... It will change my datagrid row sequence...

    Too bad even though my datagrid changes...But my database never store the new sequence...

    After I log out and log in again...The sequence are still the old one...

    How can I store it???

    private void Bindsequence(string cpjttemplt)

    {

    DataSet dsList = ProjectTaskTemplateLibrary.Get2(cpjttemplt);

    DataRow[] drResult = dsList.Tables[0].Select(this.strGlobalFilter, "Seq.#");

     

    // Resequence

    double runSeq = double.Parse(this.txtSTART.Text.Trim());double skipSeq = double.Parse(this.txtSKIP.Text.Trim());

    runSeq = runSeq - skipSeq;

     

    for (int i = 0; i < drResult.Length; i++)

    {

    runSeq += skipSeq;

    drResult[i][
    "Seq.#"] = runSeq;

    }

     

    //foreach (DataRow dr in dsList.Tables[0].Rows)

    //{

    // string nseq = dr["Seq.#"].ToString();

    //}

     

     

    DataSet dsFilter = dsList.Clone();for (int i = 0; i < drResult.Length; i++)

    {

    dsFilter.Tables[0].ImportRow(drResult[i]);

    }

    dsFilter.AcceptChanges();

     

    this.dgptemp2.DataSource = dsFilter.Tables[0];

    }

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - Rick Osborne