Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET SQL-Server
Dear Friends,
 
I have a Database with No.of Tables in it.
 
I have a one Table in it, which displays records into gridview.
 
I need to Insert Gridview Row to New Table in SqlServer 2005 database. when Select button Click in Gridview.....SELECT button will be Cell[0].
 
How to Insert the Selected Row From GRIDVIEW into Sqlserver 2005 Database New Table.
 

Please help me, Thanks.
Posted 19-Jun-12 22:30pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Check out the following code
protected void grdVacancy_SelectedIndexChanged(object sender, EventArgs e)
    {
       string query= "insert into tablename (columnname) values('"+ grdVacancy.SelectedRow.Cells[1].Text+"')";
    }
mark it solution if you got your answer and dont forget to rate..
 

 
Thanks
Ashish
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        GridViewRow r = GridView1.SelectedRow;
        string strQuery = "insert into table values('" + r.Cells[0] + "','" + r.Cells[1] + "')";
    }
 
improved only for making in code
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

write your insert query in selectedindexchange event of gridview.
  Permalink  
v2
Comments
Ranjith Reddy CSE at 20-Jun-12 4:53am
   
Please can you show me, how to write.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.140709.1 | Last Updated 16 Oct 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid