我想制作一个学分制。如果用户信用“警告:您有信用!数量:[列中的Jeton值]”,如果没有用户信用“警告:您没有信用!”我使用了 MyDAC 组件
Jeton:用户信用栏。(在数据库中)
我该如何制作?
我试图
MyQuery1.Close;
MyQuery1.SQL.Text :=' select* from uyeler '+
'where nick=:0 and jeton=:1';
MyQuery1.Params[0].AsString:=Edit1.Text;
MyQuery1.Params[1].AsString:=?must?;
MyQuery1.open;
If MyQuery1.RecordCount=0 Then
Begin
MessageDlg('warning: you have not credit!', mtWarning,[mbOK],0)
End
Else
Begin
MessageDlg('warning: you have credit! quantity: (Jeton value in column)', mtWarning,[mbOK],0)
End;
答案 0 :(得分:3)
如果jeton
字段是功劳,您可以写这样的内容。
MyQuery1.Close;
MyQuery1.SQL.Text :='select jeton from uyeler where nick=:0';
MyQuery1.Params[0].AsString:=Edit1.Text;
MyQuery1.open;
If (MyQuery1.IsEmpty) or (MyQuery1.FieldByName('jeton').AsDouble<=0) Then
Begin
MessageDlg('warning: you have not credit!', mtWarning,[mbOK],0)
End
Else
Begin
MessageDlg(Format('warning: you have credit! quantity: (%n)',[MyQuery1.FieldByName('jeton').AsDouble]), mtWarning,[mbOK],0);
end;