Thank you for your time and directions. Guidelines provided by you are very important to me and will be followed. I totally agree with you and I believe I respect members, I first dig into information resources on the net before bother list members, check list archive, but sometimes do not compose query effectively. Please give people time to learn and improve themselves, don't shoot :-).
>Cause now I still don't know if it's a bug or not. No, it is not a bug. Non-Select statements need .ExecSQL method, not .open. I had a couple of replies on this, tested and confirmed. Regards, Panagiotis -----Original Message----- From: Joost van der Sluis [mailto:[EMAIL PROTECTED] Sent: Thursday, March 16, 2006 1:03 PM To: [email protected] Subject: Re: [lazarus] SQL Statement What I missed in this question, and the one before, is the error-message you've got. It should be: 'Cannot open a non-select statement' If you had asked the question: What do I do wrong when I got: 'Cannot open a non-select statement', everyone here with some sql-knowledge would have known the answer. Then no other information was even needed, and we didn't have to dig into your code, looking at the quotes, wondering what they are and such. A quote from the link i've send: ----- Q: My {program, configuration, SQL statement} doesn't work A: This is not a question, and I'm not interested in playing Twenty Questions to pry your actual question out of you — I have better things to do. On seeing something like this, my reaction is normally of one of the following: * do you have anything else to add to that? * oh, that's too bad, I hope you get it fixed. * and this has exactly what to do with me? ----- Next time, describe accurately what happens. Cause now I still don't know if it's a bug or not. Can you tell me if the program gave the error i told about above? If not, it's a bug. If it does, I need to clarify the error-message a bit. On Wed, 2006-03-15 at 22:32 +0000, Panagiotis Sidiropoulos wrote: > It is not my intention being irritating, on the contrary. Composing > this post I thought that subject was describing the problem, focusing > on the SQL statement syntax and not to the code. I apologise. Your > answer gives me the impression that you are tired reading this kind of > not well described posts from me. I do not feel this is true, I only > had another such comment once at the past in a case not more > information was available than provided. > > What I can promise is to try harder and read url with directions > suggested. I also ask you to be patient in such cases, you see it is > an international meeting point at which people with different cultures > meet communicating in English, not mother language for many of us. > > So, please let me provide full code. While executing, code exit at > .open point. Trying a test SELECT statement it is OK. If you can think > anythink to direct me where to search it would be most helpful to me. > > // update ID data > function mgspsUpdateIDData: integer; > var > nLicensesLeft: integer; > cCustID: string; > > begin > // update > Result := MGSPS_ERROR_UPDATE_FAILED; > nLicensesLeft := > SQLQuery.FieldByName( 'ids-licenses-left' ).AsInteger - 1; > cCustID := SQLQuery.FieldByName( 'ids-internet-id' ).AsString; > SQLQuery.Close; > SQLQuery.SQL.Clear; > SQLQuery.SQL.Add( 'update `ids-aa`' ); > SQLQuery.SQL.Add( ' set `ids-licenses-left`=1' ); > SQLQuery.SQL.Add( ' where > `ids-internet-id`="aa-123456789012345678"' ); > SQLQuery.Open; > > Result := MGSPS_ALL_OK; > end; > > > An why all these quotes arount the field names? Does that even > > compile? > > These quotes are necessary maybe because of field names form, dash > character is used separating parts of names making these more > readable. I tried it without quotes and had dificulties. This way > works fine, I have Select statements executed normally but not this > Update which I think is in a general accepted form. > > As I wrote on my complementary reply, this is running on Linux using > SQLDB components and MySQL database server. > > Panagiotis > > Στις 15-03-2006, ημέρα Τετ, και ώρα 20:27 +0100, ο/η Joost van der > Sluis > έγραψε: > > This is gettig irritating. > > > > 'statement is not accepted' > > > > Is that the error message? 'statement not accepted' You can't expect > > us to keep answering this kind of questions. > > > > An why all these quotes arount the field names? Does that even > > compile? > > > > And read this, before you sent another question: > > www.catb.org/~esr/faqs/smart-questions.html > > > > On Wed, 2006-03-15 at 21:14 +0000, Panagiotis Sidiropoulos wrote: > > > I use following code to update a table. Connection is succesfuly > > > carried out and before this, Select statement executed succesfuly. > > > Problem is that this statement is not accepted. I checked this > > > same statement through an MySQL client and it was executed > > > properly. Can anyone please advise? > > > > > > SQLQuery.Close; > > > SQLQuery.SQL.Clear; > > > SQLQuery.SQL.Add( 'update `ids-aa`' ); > > > SQLQuery.SQL.Add( 'set `ids-licenses-left`=1' ); SQLQuery.SQL.Add( > > > 'where `ids-internet-id`="aa-123456789012345678"' ); showmessage( > > > SQLQuery.SQL.Text ); SQLQuery.Open; > > > > > > I also tested this statement a one line setting this to .text > > > property. > > > > > > Panagiotis > > > > > > _________________________________________________________________ > > > To unsubscribe: mail [EMAIL PROTECTED] with > > > "unsubscribe" as the Subject > > > archives at http://www.lazarus.freepascal.org/mailarchives > > > > > _________________________________________________________________ > To unsubscribe: mail [EMAIL PROTECTED] with > "unsubscribe" as the Subject > archives at http://www.lazarus.freepascal.org/mailarchives > -- Met vriendelijke groeten, Joost van der Sluis CNOC Informatiesystemen en Netwerken http://www.cnoc.nl _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
