Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
C#
string mdlist = ddlModalityList.SelectedItem.Value.ToString();
          string schaetitle=TxtSchdledStAETitle.Text;
          string schaename=TxtSchdleStationAEName.Text;



C#
query = "UPDATE Modality_Master SET Modality='"+mdlist+"', Scheduled_Station_AE_Title='"+schaetitle+"',SCHEDULED_STATION_NAME='"+schaename+"' WHERE Modality_ID='"+ModalityID+"'";
           da = new SqlDataAdapter(query, con);
           ds = new DataSet();
           da.Fill(ds);
           Rp.DataSource = ds;
           Rp.DataBind();
Posted
Comments
Mehdi Gholam 9-Apr-12 7:37am    
You will have to supply more information like error messages, we cannot guess.

You have not described the error you are getting.

The best guess that I can make here is that Modality_ID could be a number and you are trying to insert it as a string in your query. Try Modality_ID="+ModalityID; instead.
 
Share this answer
 
v2
Comments
[no name] 9-Apr-12 7:52am    
i have convert Modality_ID into int but not fire update query..
hi,

If you use Update Query then used Update Method.

SQL
query = "UPDATE Modality_Master SET Modality='"+mdlist+"', Scheduled_Station_AE_Title='"+schaetitle+"',SCHEDULED_STATION_NAME='"+schaename+"' WHERE Modality_ID='"+ModalityID+"'";
           da = new SqlDataAdapter(query, con);
           ds = new DataSet();
           da.Update(ds);
 
Share this answer
 
v2
use stored PRocedure beeter than query
the plus symbols are not using correctly then update query creates
problems.
 
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