Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How can i updata data in the textbox and them with a"save" button.. to save this changes again in the sql database.

I have tried this one:
How can i specify in the where condition, the row index??
SQL
OleDbCommand myComm = new OleDbCommand("UPDATE Customer SET Code='" + txt_code.Value + "', Description='"+txt_desc.Value+ "', DescLong = '" + txt_longdesc.Value+ "', Tel='"+txt_tel.Value+ "', Mobile = '" + txt_mobile.Value+ "' ,  WHERE ????=" + ????+ , con );
Posted
v2
Comments
faisal23 26-Nov-12 7:30am    
What do you mean by update data in textbox it is already editable. And save button write simple update query
lovitaxxxx 26-Nov-12 7:47am    
how to specify the row index of the datatable i am in a specific moment?
How are you showing these customer details in front-end (in a grid or table or using what) ?
lovitaxxxx 26-Nov-12 16:05pm    
in a textbox i retrieve data from the datatable
So, if you are retrieving data from DatatTable, then can you show that code please ?
I need to see how exactly you get data and show in textbox.

on the click of save button write dowo following code

C#
 cmd=new SQlcommand("update tablename set columnname='"+textbox.text +"' where id='"+id+"'",con);
con.open();
cmd.executeNonQUery();
con.close();


where con is connection object
cmd in sqlcommand object
id is the primary key for which row you want to update
 
Share this answer
 
Comments
lovitaxxxx 26-Nov-12 7:45am    
I have created a navigation system.. using last, first, next, previews buttons
And how cn i specify the row index in the update sql query?
Assuming you want to know how to save the data in DB, This could be useful for you: A Beginner's Tutorial for Understanding ADO.NET[^]
 
Share this answer
 

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