我用的是delphi2007里的intraweb组件,提示“修改成功”,但是数据库里没有修改??
不值是不是代码问题,我的修改代码如下:
if IWRadioButton1.Checked=true then
begin UserSession.dbsquery.Close;
UserSession.dbsquery.SQL.Clear;
UserSession.dbsquery.SQL.Add('update DS_ReplyApplication set StuSelectTopicId:='''+IWComboBox1.Text+''',ApplyReason:='''+IWMemo1.Text+''',ApplyType:='''+IWRadioButton1.Text+''' where ReplyApplicationId='''+IWEdit1.Text+''' ');
UserSession.dbsquery.ExecSQL;
end;
self.WebApplication.ShowMessage('修改成功!');
不值是不是代码问题,我的修改代码如下:
if IWRadioButton1.Checked=true then
begin UserSession.dbsquery.Close;
UserSession.dbsquery.SQL.Clear;
UserSession.dbsquery.SQL.Add('update DS_ReplyApplication set StuSelectTopicId:='''+IWComboBox1.Text+''',ApplyReason:='''+IWMemo1.Text+''',ApplyType:='''+IWRadioButton1.Text+''' where ReplyApplicationId='''+IWEdit1.Text+''' ');
UserSession.dbsquery.ExecSQL;
end;
self.WebApplication.ShowMessage('修改成功!');
你看看你的begin end ,和你的showMessage,即使没进入if 语句也会执行showmessage语句
begin UserSession.dbsquery.Close;
UserSession.dbsquery.SQL.Clear;
UserSession.dbsquery.SQL.Add('update DS_ReplyApplication set StuSelectTopicId:='''+IWComboBox1.Text+''',ApplyReason:='''+IWMemo1.Text+''',ApplyType:='''+IWRadioButton1.Text+''' where ReplyApplicationId='''+IWEdit1.Text+''' ');
try
UserSession.dbsquery.ExecSQL;
execpt
self.WebApplication.ShowMessage('修改成功!');
end;
end;
begin UserSession.dbsquery.Close;
UserSession.dbsquery.SQL.Clear;
UserSession.dbsquery.SQL.Add('update DS_ReplyApplication set StuSelectTopicId:='''+IWComboBox1.Text+''',ApplyReason:='''+IWMemo1.Text+''',ApplyType:='''+IWRadioButton1.Text+''' where ReplyApplicationId='''+IWEdit1.Text+''' ');
UserSession.dbsquery.ExecSQL;
self.WebApplication.ShowMessage('修改成功!');
end;
请问SQL语句里面有':='这样的符号吗?
StuSelectTopicId='''+IWComboBox1.Text+''',ApplyReason='''+IWMemo1.Text+''',ApplyType='''+IWRadioButton1.Text+''' where ReplyApplicationId='''+IWEdit1.Text+''
begin UserSession.dbsquery.Close;
UserSession.dbsquery.SQL.Clear;
UserSession.dbsquery.SQL.Add('update DS_ReplyApplication set StuSelectTopicId ='''+IWComboBox1.Text+''',ApplyReason='''+IWMemo1.Text+''',ApplyType='''+IWRadioButton1.Text+''' where ReplyApplicationId='''+IWEdit1.Text+''' ');
try
UserSession.dbsquery.ExecSQL;
execpt
self.WebApplication.ShowMessage('修改成功!');
end;
end;
begin UserSession.dbsquery.Close;
UserSession.dbsquery.SQL.Clear;
UserSession.dbsquery.SQL.Add('update DS_ReplyApplication set StuSelectTopicId ='''+IWComboBox1.Text+''',ApplyReason='''+IWMemo1.Text+''',ApplyType='''+IWRadioButton1.Text+''' where ReplyApplicationId='''+IWEdit1.Text+''' ');
try
UserSession.dbsquery.ExecSQL;
self.WebApplication.ShowMessage('修改成功!');
execpt
self.WebApplication.ShowMessage('修改失败!');
end;
end;
是“:=”的问题,本人刚学DELPHI不太会。
測試程序,最好在IDE環境下測,這樣有錯誤就可以捕捉到!
除非,你很自信對程序異常做了很好de處理