Adding values of two text boxes in windows application

Posted by Chaithragm under C# on 4/3/2013 | Points: 10 | Views : 3069 | Status : [Member] | Replies : 2
Hi

Im having two textboxes
1)textbox1=value is binded from the database in the pageload
2)textbox2=users had to enter the value here

value from textbox2 is added to value in textbox1 and that value must save to server




Responses

Posted by: Jayasugan on: 4/3/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Chaithragm ,

Try This,

string Txt2=textbox2.text;
TextBox1.text=Txt2;

establish Sqlconnection
write SqlCommand="Update Table_Name set column_name='""+Txt2+'" where Yourcondition";

SAVED IN DB

In PageLoad
Asusual Bind Code for TextBox1


Mark as Answer if it is helpful to You

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

Posted by: Raj.Trivedi on: 4/3/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Chaithragm ,

Get the value of from the database in datatable

textbox1.text = dt.Rows[0]["Columnname"].to String

Textbox 2.text = "Your Value";

on Save button click button write this

string addvalues = textbox1.text + textbox2.text
and
save the string variable into database
as

insert into table Test(Testfield) values ('"+addvalues"');

Regard's
Raj.Trivedi
"Sharing is Caring"
Please mark as answer if your Query is resolved

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

Login to post response