I have a database and there is an 'users table' in it. In this table, there are columns which contain users information (site, nick, jeton, mail, sifre). I am trying to make a program based on a credit system. Any user runs the program, than, if the users credit is equal to number of sites in listbox (i mean number of lines) the users site will appear in the listbox. Otherwise, it won't appear.
In the database, value in 'credits' column must be equal to number of lines in listbox. For example, if any users credit value is 4 and there are 5 lines in listbox, the users site won't be added to listbox. But if the user's credit value is 5 or higher, his/her site will be added (listed) in the listbox.
uyeler = table
nick = user name column.
site = user site name column.
jeton = user credit column.
mail = user mail column.
sifre = user password column.
I tried these;
MyQuery1.Close;
MyQuery1.SQL.Text :='SELECT jeton, site FROM uyeler WHERE jeton > 0 ORDER BY site';
MyQuery1.Open;
ListBox1.Items.Clear;
If (MyQuery1.IsEmpty) or (MyQuery1.FieldByName('jeton').AsString > IntToStr(Listbox1.Items.Count)) Then
Begin
MessageDlg('warning: you have not credit!', mtWarning,[mbOK],0)
End
Else
Begin
While not MyQuery1.Eof do
Begin
ListBox1.Items.Add(MyQuery1.Fields[1].AsString);
MyQuery1.Next;
end;
MyQuery1.Close;
End;