how can i save all DataGrid data to SQL 2005 in ASP.net C#

Last post 05-06-2008 3:48 AM by winzone. 2 replies.

Sort Posts:

  • how can i save all DataGrid data to SQL 2005 in ASP.net C#

    05-05-2008, 3:09 AM
    • Loading...
    • winzone
    • Joined on 01-18-2006, 11:44 PM
    • Sg
    • Posts 44

     Hi all ,

     I want to save all data from DataGrid to SQL 2005 in asp.net C# .That datagrid data is imported from excel file and save back to SQL with loop. 

     please help me
    WinZone
  • Re: how can i save all DataGrid data to SQL 2005 in ASP.net C#

    05-05-2008, 5:14 AM
    Answer
    • Loading...
    • anzer
    • Joined on 10-19-2004, 4:00 AM
    • UAE
    • Posts 824

    You can loop through the rows of a gridview by following code

                foreach (GridViewRow grvRow in GridView1.Rows)
                {
                    //grvRow.Cells[0].Text
                }

    You can use the commented line to get the data inside each colum if you are using BindColumns. If there are any TemplateColumns you need to use the  FindControl method.

    If this post was useful to you, please mark it as answer.

    My Blog | Free books Microsoft
  • Re: how can i save all DataGrid data to SQL 2005 in ASP.net C#

    05-06-2008, 3:48 AM
    • Loading...
    • winzone
    • Joined on 01-18-2006, 11:44 PM
    • Sg
    • Posts 44

     Thank anzer,

     I will test it and reply to you if any problem occur.

    Big Smile
     

    WinZone
Page 1 of 1 (3 items)
Microsoft Communities
Page view counter