0

我想做一个信用系统。如果有用户积分“警告:您有积分!数量:[列中的杰顿值]”,如果没有用户积分“警告:您没有积分!” 我使用了 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;
4

1 回答 1

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;
于 2012-08-05T18:29:39.480 回答