Jump to content
PenelopeSkye

Missing CommandText property

Recommended Posts

I am trying to insert into a database.  I am using the code below.  When I run the code I get the error message also below.

It is my understanding that the command text is only if you are using a sql statement which I am not.  

What am I missing?  Thanks!

 

procedure TfDesignMaster.btnAddUserClick(Sender: TObject);
var
   userstring,OldValue: string;
begin

 with dm do
   begin
      userstring := CurrentUserName;
      OldValue := dbedit23.text;

 

      dsetAddUser.Open;
      

      tbAddUser.Insert;
      tbAddUser['JM_User'] := userstring;
      tbAddUser['OldValue'] := DBEdit23.Text;
      tbAddUser.Post;
     end;
end;

 

 

image.png.3f00cd8fde3f8f7a04d94d51e9c7ccbb.png

Share this post


Link to post

Hi,
Generally, I use this syntax

      tbAddUser.Insert;
      tbAddUser.FieldByName('JM_User').asString := userstring;
      tbAddUser.FieldByName('OldValue').asString := DBEdit23.Text;
      tbAddUser.Post; 

 

Share this post


Link to post

too little information

... SQL gets used either way.

 

my shortcut: ctrl+j->mydummy

with cdsDUMMY do
   begin
    Close; Params.Clear; IndexName := '';
    CommandText := '';
    Params.ParseSQL(CommandText,True);
    Params.ParamByName('').AssignFieldValue();
    Open;
   end;

depends on architecture - maybe apply latter 🙂

regards

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×