store the value of datagrid to database

Discussion in 'ASP .Net Datagrid Control' started by Thiyagarajan Natarajan, Oct 13, 2005.

  1. Hi all!
    I am getting the data from datagrid. and i have to store in database by
    cliking the save button.

    private void imgbtnSave_Click(object sender, System.Web.UI.
    ImageClickEventArgs e)
    {
    StringBuilder sbQuery = new StringBuilder("");
    sbQuery.Append("insert into CT_Customers(Module,subModule,Version)values")
    foreach(DataGridItem dgi in this.dgModule.Items)
    {
    sbQuery.Append("'"+ dgi.Cells[1].Text.ToString().Trim().Replace("'","''")+"',
    ");
    sbQuery.Append("'"+ dgi.Cells[2].Text.ToString().Trim().Replace("'","''")
    +"',");
    sbQuery.Append("'"+ dgi.Cells[3].Text.ToString().Trim().Replace("'","''")+"',
    ");
    }
    }
    SQLHelper.ExecuteNonQuery(sbQuery.ToString());



    but it doesn't go to even foreach loop while debugging.

    can anybody help me please??
    thanks all
    Thiyagarajan Natarajan, Oct 13, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Max
    Replies:
    2
    Views:
    430
  2. selen

    document store database

    selen, Jan 28, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    370
    Hermit Dave
    Jan 28, 2004
  3. Bennett Haselton
    Replies:
    1
    Views:
    6,646
    bruce barker
    Oct 14, 2004
  4. =?Utf-8?B?UnVkeQ==?=

    to store or not to store an image

    =?Utf-8?B?UnVkeQ==?=, Mar 29, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    617
    =?Utf-8?B?UnVkeQ==?=
    Mar 30, 2005
  5. Jon J.

    How to store name/value pairs in DataGrid?

    Jon J., Oct 11, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    140
    Jon J.
    Oct 11, 2004
Loading...

Share This Page