Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i update data in the textbox and then save them to the database.. by clicking a button "update".
before clicking that button.. textboxes should be uneditable.
after click the "modify" button textboxes become editable.. i change data and then with one "save" button the updated datas will be saved in the database
Posted
Comments
joshrduncan2012 9-Nov-12 9:35am    
What have you tried so far?

1 solution

When you load the form, set the text property of the textbox to the value of your field. Set the ReadOnly property of the text box to true. When the user clicks 'update', validate that they have permissions to change the field(s) and clear the ReadOnly flag on the one(s) they are allowed to edit.

When they click save, validate the new data and then save it back to your database. Optionally set the ReadOnly flag back to true to prevent further updates.

The database operations for lookup and update we will leave to you because it is dependent on how you are connecting. There are lots and lots of examples on here and Google for doing the DB CRUD operations for all the different connection methods.
 
Share this answer
 
Comments
Divya RS 9-Nov-12 23:24pm    
Google as 'Setting readonly property of textbox on button click' and 'Save vlue from textbox to database', that will help you for sure
Ahmed_online 10-Nov-12 13:53pm    
first tell us about mode connection

connected or disconnected

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900