locked
Storing Gridview Data to SQL RRS feed

  • Question

  • User647140111 posted

    Hi,

    How can I store data of Gridview to a table of SQL Database.? For Example:

    The Gridview has following columns:

    1. Name

    2. Country

    3. Job

    4. DOB5. Email

    All these data in the Gridview should be stored in the table named "contacts" under right columns (Name,Country, Job, DOB, Email) in SQL.

    Please advise on how to implement this using VB.NET.

    Saturday, February 8, 2014 7:20 AM

Answers

  • User1176121428 posted

    Hi Fahim876,

    Thanks for your reply.

    According to your description, maybe you want display data from database in gridview in my view.

    You can code in page_load,like this:

    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
       {
           BindGridView();
       }
    }

    Hope this helps you.

    If I misunderstand you,Please provide us more information.
    Best Regards,

    Eileen

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 13, 2014 12:25 AM

All replies

  • User-760709272 posted

    This post contains code on how you traverse a GridView to access the controls inside it.  It's in c# but the basics are the same.

    http://forums.asp.net/t/1963903.aspx?Finding+controls

    Saturday, February 8, 2014 7:45 AM
  • User647140111 posted

    Hi Aidy,

    The given post in your comment doesn't include any section to show gridview data in database.

    Please advise on this.

    Saturday, February 8, 2014 7:52 AM
  • User1176121428 posted

    Hi Fahim876,

    Thanks for your post.

    According to your description,Based on my understanding,you want to save data in gridview to sql database.

    So here is a sample:

    Save and Retrieve Dynamic TextBox values in GridView to SQL Server Database

    Hope this helps you.

    Best Regards,

    Eileen

    Wednesday, February 12, 2014 3:02 AM
  • User647140111 posted

    Hi Eileen,

    Thanks for your reply,

    I need the gridview data to be stored in database. For example:

    If the Gridview has following columns:

    1. Name

    2. Country

    3. Job

    4. DOB5. Email

    All these data in the Gridview should be stored in the table named "contacts" under right columns (Name,Country, Job, DOB, Email) in SQL.

    Regards,

    Fahim

    Wednesday, February 12, 2014 2:38 PM
  • User1176121428 posted

    Hi Fahim876,

    Thanks for your reply.

    According to your description, maybe you want display data from database in gridview in my view.

    You can code in page_load,like this:

    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
       {
           BindGridView();
       }
    }

    Hope this helps you.

    If I misunderstand you,Please provide us more information.
    Best Regards,

    Eileen

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 13, 2014 12:25 AM