Go Back
  • April 06

    Inserting a Duplicate DataRow to a DataSet

    Posted Under: General Programming Tags: C# DataSet

    While developing an online form, I came upon the need to insert two copies the results to a database, one for each of two options selected on the form. The only thing different between these entries would be this option, and of course, the autogenerated ID for the row's primary key.

    While I could simply call the Insert function of the TableAdapter twice, this method requires that each field be explicitly submitted as a parameter, and since the data is coming from textboxes, and there are about a dozen boxes on the page, that's a whole lot of textbox.Text.Trim() arguments!...

    Read More »

  • January 24

    Editing The Datasource

    Posted Under: General Programming Tags: DataSet

    Ahh it's all coming back to me now... the headaches that is :P

    One thing that I would always forget how to do with the new asp.net 2.0 data controls is how to enable editing using the datasource. I set up the sql statements for select, insert, update, and delete, but only select would work. when I update something and save, it just reverts back...

    the problem is that I forgot to set the Datakeys property for the control which I want to edit. It must be set to the primary key of the table in order to enable "out ...

    Read More »