Thread View: borland.public.cppbuilder.database.ado
3 messages
3 total messages
Started by siraj
Thu, 21 Sep 2006 12:16
invalid field size TADOQuery
Author: siraj
Date: Thu, 21 Sep 2006 12:16
Date: Thu, 21 Sep 2006 12:16
24 lines
1780 bytes
1780 bytes
Hi,
I am using c++ builder and MS access 2000. I used the microsoft jet 4.0
oledb provider.
In one of the query,
sprintf(cmd,"SELECT
Avg(IIf(((Conc)*%lf)<((%lf)*%lf),(%lf)*%lf,((Conc)*%lf))) as AvgConc,Channel
FROM archives WHERE ((ts>= %lf AND ts<= %lf) AND Transit<>1 AND
DisplayFlag=true AND conc is NOT NULL ) GROUP BY
channe1",dMultiplicationFactor,dMinimumValue,dMultiplicationFactor,dMinimumV
alue,dMultiplicationFactor,dMultiplicationFactor,ss,ee);
ReportConcADOQuery->Close();
ReportConcADOQuery->SQL->Clear();
ReportConcADOQuery->SQL->Add(cmd);
ReportConcADOQuery->Open();
I am getting the error "EDatabaseError" "Invalid field size".
Can any body help please.
I searched a lot but could not find a solution.
Regards,
Siraj
Re: invalid field size TADOQuery
Author: Bob Swart
Date: Thu, 21 Sep 2006 12:54
Date: Thu, 21 Sep 2006 12:54
36 lines
2354 bytes
2354 bytes
Hi siraj,
> sprintf(cmd,"SELECT
> Avg(IIf(((Conc)*%lf)<((%lf)*%lf),(%lf)*%lf,((Conc)*%lf))) as AvgConc,Channel
> FROM archives WHERE ((ts>= %lf AND ts<= %lf) AND Transit<>1 AND
> DisplayFlag=true AND conc is NOT NULL ) GROUP BY
> channe1",dMultiplicationFactor,dMinimumValue,dMultiplicationFactor,dMinimumV
> alue,dMultiplicationFactor,dMultiplicationFactor,ss,ee);
I guess it would help to show the result of this "cmd" after the sprintf
command (I don't have the mental capacity right now to produce it in my
head right now).
> ReportConcADOQuery->Close();
> ReportConcADOQuery->SQL->Clear();
> ReportConcADOQuery->SQL->Add(cmd);
> ReportConcADOQuery->Open();
>
> I am getting the error "EDatabaseError" "Invalid field size".
You could set breakpoints to find out there the error is happening. I
have a feeling it's simple happening at the Open() command, because
something is wrong inside the "cmd" itself...
Please just post an example of the cmd you're using here. Perhaps one of
the field values is empty (or NULL) in some cases?
> Siraj
Groetjes,
Bob Swart
--
Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi
Blog: http://www.drbob42.com/blog - RSS: http://drbob42.com/weblog.xml
New Delphi 2006 Courseware e-books at http://www.eBob42.com/courseware
Re: invalid field size TADOQuery
Author: siraj
Date: Thu, 21 Sep 2006 13:57
Date: Thu, 21 Sep 2006 13:57
59 lines
3022 bytes
3022 bytes
It is happening at the line where the query is opened. ReportConcADOQuery->Open(); The "invalid field size" error is occuring randomly on the same command. Some times it does not give an error at all The sql command is SELECT Avg(IIf(((Conc)*1.000000)<((0.020000)*1.000000),(0.020000)*1.000000,((Conc)* 1.000000))) as AvgConc,Channel FROM archives WHERE ((ts>= 38952.000000 AND ts<= 38962.000000) AND Transit<>1 AND DisplayFlag=true AND conc is NOT NULL) GROUP BY Channel; Regards, Siraj "Bob Swart" <b.swart@chello.nl> a οΏ½crit dans le message de news:45128B9C.6030609@chello.nl... > Hi siraj, > > > sprintf(cmd,"SELECT > > Avg(IIf(((Conc)*%lf)<((%lf)*%lf),(%lf)*%lf,((Conc)*%lf))) as AvgConc,Channel > > FROM archives WHERE ((ts>= %lf AND ts<= %lf) AND Transit<>1 AND > > DisplayFlag=true AND conc is NOT NULL ) GROUP BY > > channe1",dMultiplicationFactor,dMinimumValue,dMultiplicationFactor,dMinimumV > > alue,dMultiplicationFactor,dMultiplicationFactor,ss,ee); > > I guess it would help to show the result of this "cmd" after the sprintf > command (I don't have the mental capacity right now to produce it in my > head right now). > > > ReportConcADOQuery->Close(); > > ReportConcADOQuery->SQL->Clear(); > > ReportConcADOQuery->SQL->Add(cmd); > > ReportConcADOQuery->Open(); > > > > I am getting the error "EDatabaseError" "Invalid field size". > > You could set breakpoints to find out there the error is happening. I > have a feeling it's simple happening at the Open() command, because > something is wrong inside the "cmd" itself... > > Please just post an example of the cmd you're using here. Perhaps one of > the field values is empty (or NULL) in some cases? > > > Siraj > > Groetjes, > Bob Swart > > -- > Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi > Blog: http://www.drbob42.com/blog - RSS: http://drbob42.com/weblog.xml > New Delphi 2006 Courseware e-books at http://www.eBob42.com/courseware
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads