gridview add and modify

Posted by Suneel161 under Regular Expressions on 3/26/2010 | Views : 1099 | Status : [Member] | Replies : 3
hii

how to insert and update data in single button.




Responses

Posted by: Sagarp on: 3/26/2010 [Member] Bronze

Up
0
Down
Hi friend

check following article

http://www.codedigest.com/Articles/ASPNET/281_Edit_Update_Delete_and_Insert_data_with_DataList_control_using_LINQ.aspx 


Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Suneel161, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 3/26/2010 [Member] Bronze

Up
0
Down
Hi friend

check following links
http://forums.asp.net/p/1339766/2794745.aspx#2794745 


Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Suneel161, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Syedshakeer on: 3/29/2010 [Member] Starter

Up
0
Down
Hi

if(button1.Text=="add")
{
SqlCommand cmd=new SqlCommand("insert into tablename(id,name) values("+txtid.Text+",'"+txtname.Text|"'",conn);
cmd.ExecuteNonQuery();
button1.Text="Update";
}
else
{
SqlCommand cmd=new SqlCommand("update tablename set name='"+txtname.Text where id="+txtid.Text+"",conn);
cmd.ExecuteNonQuery();
button1.Text="add";

}

Syed Shakeer Hussain

Suneel161, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response