Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-08

Error with TSQLite3Dataset?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Arí Ricardo Ody

I use ExecuteDirect method to insert a record in a SQLite3 SQL tabel. The primary key is a sequential integer number. I have the follwoind contruction in the moment I will execute the SQL Insert command:

 try
 cdsInventario.ExecuteDirect(auxstr);
 except
 On e:Exception do
 begin;
 ShowMessageMobile(Self,'Error INSERT Item = ' + e.Message);
 Exit;
 end;
 end;

I discover that when the PK value is equal to the last(at least) sequential number recorded in the SQL tabel the command Insert does nothing and the except clause is not executed(I'm sure of this). Late I change the logic to ensure that the value given to the PK in the Insert differ from any one in the dataset and then everything's fine.

Do somebody have comments?

Greeting from S?o Paulo - Brasil

Ricardo

P.S.: The problem occurs with Lazarus 0.9.30 since the last Lazarus version the clear screen for windows CE version is in error. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130806/09f745bd/attachment.html>

Reply by email

luiz americo pereira camara
to Arí Ricardo Ody

Try ExecSQL

What is in "auxstr"?

What is your Table definition?

Since you are updating data using direct SQL, you will need to close and re open the dataset so the dataset record is in sync

Luiz

2013/8/5 "Ar? Ricardo Ody" :

Show quoted text 34 lines
I use ExecuteDirect method to insert a record in a SQLite3 SQL tabel. The primary key is a sequential integer number. I have the follwoind contruction in the moment I will execute the SQL Insert command: try cdsInventario.ExecuteDirect(auxstr); except On e:Exception do begin; ShowMessageMobile(Self,'Error INSERT Item = ' + e.Message); Exit; end; end; I discover that when the PK value is equal to the last(at least) sequential number recorded in the SQL tabel the command Insert does nothing and the except clause is not executed(I'm sure of this). Late I change the logic to ensure that the value given to the PK in the Insert differ from any one in the dataset and then everything's fine. Do somebody have comments? Greeting from S?o Paulo - Brasil Ricardo P.S.: The problem occurs with Lazarus 0.9.30 since the last Lazarus version the clear screen for windows CE version is in error. -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Arí Ricardo Ody

I know other ways to do. I would like know why it doesn't work. "auxstr is string variable with Insert command in it.

Lets forget my question. Let the error goes on.

Bye

Earlier message 10 lines
----- Original Message ----- From: luiz americo pereira camara Sent: 08/05/13 07:09 PM To: Lazarus mailing list Subject: Re: [Lazarus] Error with TSQLite3Dataset? Try ExecSQL What is in "auxstr"? What is your Table definition? Since you are updating data using direct SQL, you will need to close and re open the dataset so the dataset record is in sync Luiz 2013/8/5 "Ar? Ricardo Ody" : > I use ExecuteDirect method to insert a record in a SQLite3 SQL tabel. The > primary key is a sequential integer number. I have the follwoind contruction > in the moment I will execute the SQL Insert command: > > try > cdsInventario.ExecuteDirect(auxstr); > except > On e:Exception do > begin; > ShowMessageMobile(Self,'Error INSERT Item = ' + e.Message); > Exit; > end; > end; > > I discover that when the PK value is equal to the last(at least) sequential > number recorded in the SQL tabel the command Insert does nothing and the > except clause is not executed(I'm sure of this). Late I change the logic to > ensure that the value given to the PK in the Insert differ from any one in > the dataset and then everything's fine. > > Do somebody have comments? > > Greeting from S?o Paulo - Brasil > > Ricardo > > P.S.: The problem occurs with Lazarus 0.9.30 since the last Lazarus version > the clear screen for windows CE version is in error. > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130806/f6057d7c/attachment.html>

Reply by email