我的更新查询出了什么问题

问题描述:

string mdlist = ddlModalityList.SelectedItem.Value.ToString();
          string schaetitle=TxtSchdledStAETitle.Text;
          string schaename=TxtSchdleStationAEName.Text;







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();

您尚未描述所得到的错误.

我在这里可以做的最好的猜测是Modality_ID可能是数字,并且您正在尝试将其作为字符串插入查询中.尝试使用Modality_ID="+ModalityID;.
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.




如果使用更新查询,则使用更新方法.



If you use Update Query then used Update Method.

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);


使用存储的过程甜菜比查询
加号符号使用不正确,然后更新查询创建
问题.
use stored PRocedure beeter than query
the plus symbols are not using correctly then update query creates
problems.