Forum > Databases
DBLookupCombobox problem when create on the fly and post reccord
(1/1)
rmmm:
Hi Everyone here,
I have a problem and attachement a simple project to ilustrate it.
When i create "on the fly", after post, the component inactive :(
If i use component from form, all is OK. :o
Can someone advise, where's my fault?
Thanks!
--- 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.FormCreate(Sender: TObject);varSQL1:TSQLQuery;DTS1:TDataSource;begin with MySQL56Connection1 do begin HostName:='localhost'; UserName:=''; //'user24'; Password:=''; //'2024'; DataBaseName:='db24'; Connected:=True; end; SQLTransaction1.Active:=True; with SQLQuery1 do begin SQL.Text:='select * from art'; Open; end; // { // OPTION I: WORK FINE with SQLQuery2 do begin SQL.Text:='select * from fam order by fam_nom'; Open; DBLookupComboBox1.ListSource:=DataSource2;end; // } //{// OPTION II: "After update and post" component DBLookupComboBox1 "DISABLED"; with SQL1 do begin SQL1:=TSQLQuery.Create(Self); Database:= SQLQuery1.DataBase; Transaction:=SQLQuery1.Transaction; SQL.Text:='select * from fam order by fam_nom'; Open; DTS1:=TDataSource.Create(Self); DTS1.DataSet:=SQL1; DBLookupComboBox1.ListSource:=DTS1; SQL1:=nil; DTS1:=nil; end;// }end;
rmmm:
Hi
All components link to this SQL1 is disabled after update other SQL
Repair it.
thanks a lot.
--- 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";}};} --- with SQL1 do begin SQL1:=TSQLQuery.Create(Self); SQL1.Database:= SQLQuery1.DataBase; Transaction:=SQLQuery1.Transaction; SQL1.AfterClose:=@SQLQueryAfterClose; // <------- HERE SQL.Text:='select * ... Open;....
--- 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.SQLQueryAfterClose(DataSet: TDataSet);begin DataSet.Active:=True;end;
Navigation
[0] Message Index