Jump to content

DbGo AdoDataset.CommandTest in MainModule


CCH4UNIGUI

Recommended Posts

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

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...