how to update data from tabel using C#.net
i've a form opened which is has loaded some sort of data (like username,
CNIC, Contact no, etc etc) in Check boxes, now i want to update the data
in such manner that i simply change the text in the text boxes and click
on the save changes to save it, i've tried it but i am not able to do it
in correct manner. let me show you how I've coded, the code i did in
frmViewformList savechanges button is :
private void btnSaveChanges_Click(object sender, EventArgs e)
{
string sql;
string UserName;
UserName = txtUserName.Text; // saving data loaded on run time to
UserName
sql = "";
sql += "UPDATE UserLogin";
sql += "SET Name = "+ //how to access data I've changed in TextBox
after loading +"";
sql += "WHERE Name= " + //how to access data which was in text box
right after loading + ""; //
}
i am a bit confuse how to to refer data, like the name already in the text
box or the name which i have changes and how to write it in SQL query...
this question is a big confusing i know, let me explain, the form is
loaded , there are text boxes which is being populated with the data in
database on load event, i change the data in text boxes and save on click
so that the update query runs and changes the data in database as well....
i'm not able to create logic here how to do this, can any one help me out,
?? i am sorry i am a new developer of C# that's why i am bit Confusing...
No comments:
Post a Comment