Re: [lazarus] DataBase Queries
On Mon, 4 Feb 2008, el stamatakos wrote: Hi, I am working with a database and I am doing the following tFile:string; tFileName:=mainForm.SQLQuery1.FieldValues['tFileName']; You should never use FieldValues, this is a horrible construct which Delphi introduced for Visual Basic compatibility. You should use tFileName:=mainForm.SQLQuery1.FieldByName('TFileName').AsString; instead. Michael. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] DataBase Queries
2008/2/5, Michael Van Canneyt [EMAIL PROTECTED]: On Mon, 4 Feb 2008, el stamatakos wrote: Hi, I am working with a database and I am doing the following tFile:string; tFileName:=mainForm.SQLQuery1.FieldValues['tFileName']; You should never use FieldValues, this is a horrible construct which Delphi introduced for Visual Basic compatibility. You should use tFileName:=mainForm.SQLQuery1.FieldByName('TFileName').AsString; instead. exactly...and I seem to remember that there was a bug in the reader method of the FieldValues property which prevented it to work. R# . _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
RE: [lazarus] DataBase Queries
Hi Michael. Thanks for all your help. I will try it out. Best, Lefti Date: Tue, 5 Feb 2008 09:15:37 +0100 From: [EMAIL PROTECTED] To: lazarus@miraclec.com Subject: Re: [lazarus] DataBase QueriesOn Mon, 4 Feb 2008, el stamatakos wrote: Hi, I am working with a database and I am doing the followingtFile:string; tFileName:=mainForm.SQLQuery1.FieldValues['tFileName']; You should never use FieldValues, this is a horrible construct which Delphi introduced for Visual Basic compatibility. You should use tFileName:=mainForm.SQLQuery1.FieldByName('TFileName').AsString; instead. Michael. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] DataBase Queries
Hi, I am working with a database and I am doing the following tFile:string; tFileName:=mainForm.SQLQuery1.FieldValues['tFileName']; where tFileName is in a database and is a string. I keep getting a EVariant error on this line. Is there any way to force mainForm.SQLQuery1.FieldValues['tFileName'] to return a string or at least be less restrictive so as to run with a warning. Any ways around this would be very helful. Thanks Lefti
Re: [lazarus] DataBase Queries
el stamatakos wrote: Hi, I am working with a database and I am doing the following tFile:string; tFileName:=mainForm.SQLQuery1.FieldValues['tFileName']; where tFileName is in a database and is a string. I keep getting a EVariant error on this line. Is there any way to force mainForm.SQLQuery1.FieldValues['tFileName'] to return a string or at least be less restrictive so as to run with a warning. Any ways around this would be very helful. Thanks Lefti Hi Lefti, Is the first declaration meant to be tFileNAME: String ? If not, what is tFileName ? I presume you have a field called tFileName ? ps. You nay have a good reason for the names tFileName and tFile, but it seems to me you are asking for confusion, because they look so much like types. TFileName was a type (string[80} ?) somewhere back in the borland pascal or early Delphi days, I don't know if it is still defined. cheers, John Sunderland _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
RE: [lazarus] DataBase Queries
hi, Actually it is tchFileName:string and tchFileName:=mainForm.SQLQuery1.FieldValues['tchFileName']; Thanks Date: Tue, 5 Feb 2008 15:36:55 +1100 From: [EMAIL PROTECTED] To: lazarus@miraclec.com Subject: Re: [lazarus] DataBase Queries el stamatakos wrote: Hi, I am working with a database and I am doing the following tFile:string;tFileName:=mainForm.SQLQuery1.FieldValues['tFileName']; where tFileName is in a database and is a string.I keep getting a EVariant error on this line. Is there any way to force mainForm.SQLQuery1.FieldValues['tFileName'] to return a string or at least be less restrictive so as to run with a warning. Any ways around this would be very helful. ThanksLefti Hi Lefti, Is the first declaration meant to be tFileNAME: String ? If not, what is tFileName ? I presume you have a field called tFileName ? ps. You nay have a good reason for the names tFileName and tFile, but it seems to me you are asking for confusion, because they look so much like types. TFileName was a type (string[80} ?) somewhere back in the borland pascal or early Delphi days, I don't know if it is still defined. cheers, John Sunderland _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives