Forum > Databases

[SOLVED] (MEMO)s in my TDBComboBox

<< < (2/2)

This works:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.ReloadComboBox;begin  DBComboBox1.Clear;  ZQ2.Close;  ZQ2.SQL.Text := 'SELECT name FROM pupils';  ZQ2.Open;  ZQ2.First;  while not ZQ2.EOF do  begin      DBComboBox1.Items.Add(ZQ2.FieldByName('name').AsString);  // changed .DisplayText to .AsString    ZQ2.Next;  end;  DBComboBox1.Sorted := True;end;
Thanks for your input, Zvoni.  It pushed me in the right direction.

Just saw it: You'll have to explain why you use a TDBComboBox, which is a Data-aware Control, when you're manually filling it up.
That's why i stumbled with the SQL

Already ahead of you.  I changed that to a regular TComboBox after I ran a few checks on the DBComboBox. 

When I first added that DBComboBox and hard-wired the SQL string of the ZEOS Query component, it just loaded one (MEMO).  So I added the Reload procedure, and that did add all the table rows.  But all were (MEMO).  That brought me here, to the forum.  And right after posting the above, I saw that I cldn't select anything from the DBComboBox.  A TComboBox solved that. 


[0] Message Index

[*] Previous page

Go to full version