0

信用制度を作りたい。ユーザー クレジットがある場合 "警告:クレジットがあります! 数量: [列の 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;
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 に答える