CCH4UNIGUI Posted March 5, 2021 Share Posted March 5, 2021 Hi Sherzod In MainModule: EmployeeTable.CommandText:='select * from employee WHERE ID='''+ '8180'+'''' <Works perfectly ie EmployeeTable opens and only data where id=8180 is shown> In LoginForm: UniMainModule.cUsername:=UserNameUniEdit.Text; <input as 8180 & value verified in MainForm as 8180> <cUsername declared as public in MainModule> Problem in MainModule EmployeeTable.CommandText:='select * from employee WHERE ID='''+ cUserName+'''' <EmployeeTable opens with no data> EmployeeTable.CommandText:='select * from employee WHERE ID='QutotedStr(cUserName) <EmployeeTable opens with no data> EmployeeTable.CommandText:='select * from employee WHERE ID=cUserName <EmployeeTable does not open at all> Can someone assist in correcting the CommandText syntax Link to comment Share on other sites More sharing options...
CCH4UNIGUI Posted March 5, 2021 Author Share Posted March 5, 2021 Just now, CCH4UNIGUI said: Hi Sherzod In MainModule: EmployeeTable.CommandText:='select * from employee WHERE ID='''+ '8180'+'''' <Works perfectly ie EmployeeTable opens and only data where id=8180 is shown> In LoginForm: UniMainModule.cUsername:=UserNameUniEdit.Text; <input as 8180 & value verified in MainForm as 8180> <cUsername declared as public in MainModule> Problem in MainModule EmployeeTable.CommandText:='select * from employee WHERE ID='''+ cUserName+'''' <EmployeeTable opens with no data> EmployeeTable.CommandText:='select * from employee WHERE ID='QutotedStr(cUserName) <EmployeeTable opens with no data> EmployeeTable.CommandText:='select * from employee WHERE ID=cUserName <EmployeeTable does not open at all> Can someone assist in correcting the CommandText syntax FYI, actual codes procedure TUniMainModule.UniGUIMainModuleCreate(Sender: TObject); begin EmployeeTable.Active:=False; //opened but no data EmployeeTable.CommandText:='select * from employee WHERE ID='''+ cUserName+'''' ; //works perfectly EmployeeTable.CommandText:='select * from employee WHERE ID='''+ '8180'+'''' ; //opened but no data EmployeeTable.CommandText:='select * from employee WHERE ID='+QuotedStr(cUsername) ; EmployeeTable.CommandText:='select * from employee WHERE ID='+cUsername ; EmployeeTable.Active:=True; end; Link to comment Share on other sites More sharing options...
CCH4UNIGUI Posted March 5, 2021 Author Share Posted March 5, 2021 Just now, CCH4UNIGUI said: FYI, actual codes procedure TUniMainModule.UniGUIMainModuleCreate(Sender: TObject); begin EmployeeTable.Active:=False; //opened but no data EmployeeTable.CommandText:='select * from employee WHERE ID='''+ cUserName+'''' ; //works perfectly EmployeeTable.CommandText:='select * from employee WHERE ID='''+ '8180'+'''' ; //opened but no data EmployeeTable.CommandText:='select * from employee WHERE ID='+QuotedStr(cUsername) ; EmployeeTable.CommandText:='select * from employee WHERE ID='+cUsername ; EmployeeTable.Active:=True; end; Solved. Will work on MainForm.OnCreate event Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now