我想做一个信用系统。如果有用户信用“警告:您有信用!数量: 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;发布于 2012-08-05 18:29:39
如果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;https://stackoverflow.com/questions/11818904
复制相似问题