save from datagrid to sql table RRS feed

  • Question

  • Hi all                                                                                                                        vs.net 2005 professional edition

    I want to save the rows from datagrid to sql table

    I have a datagrid in my Winform application like

                                                              s.no         testname  testadd testno 
                                                                   1           Jam        NYC       109

                                                                    2            Dev        DC          210

    column names of the grid with multiple rows

    when i hit save in my app  ,I pass a foreign key value along with datagrid rows

    In the sql side I to save  this rows in a table  with the foreign key =12 value like  

                                                              ffkey     testname   testadd     testno
                                                                12           jam               NYC      109
                                                                  12          Dev              DC           210

    How to achieve this  from Win forms side and SQL server side

    Any help is greatly appreciated

    Thanks in advance

    Friday, January 2, 2009 3:17 PM

All replies

  • Hi Maddy06, There are mutiple options available to save the results from a data grid to a server. Most importantly, you need to pick a data acess technology that works best for you. For the use case you mention above, you can directly write your SQL statements and execute them via an ADO.Net provider when the SAVE button is clicked. More information on how to use ADO.Net at: http://msdn.microsoft.com/en-us/library/aa302325.aspx

    There are other technologies like Entity Framework, LINQ to SQL and WCF Data Services, which you could pick up from based on your application needs.

    Disclaimer: This posting is provided "AS IS" with no warranties, and confers no rights
    Friday, April 23, 2010 9:52 PM