I want to make a credit system. If have user credits "warning: you have credit! quantity: [Jeton value in column]", If have not user credits "warning: you have not credit!" I used MyDAC Components
Jeton: User credit column.(In database)
How do I make it?
I tried to make
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;
If the jeton
field is the credit, you can write something like this.
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;