473,394 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Error while creating a chart with SQL

Hello guys!!! I am new here and I am trying to create a chart resulting from a filter created in VBA, in which I first filter data with an SQL statement (Select...) and then I make a filter of time (something like: AND [Beginn] >=" + Date_exact_US_SQL(txtVon) + " AND [Beginn] <=" + Date_exact_US_SQL(LDate)...
The chart is created when I call it for one value, I use:
strSQL = strSQL + " SELECT '" + CStr(cboPST.Value) + "' AS Typ and then the date filter
And the chart plots cbo.PST AS Typ. So, it works.

THE PROBLEM

When I do the same, but for:
strSQLpst = "SELECT DISTINCT [PST] AS Typ
It plots the PST for all the dates given in the query it is based on.
However, when I introduce the date filter I get the following message:
An error occurred while sending data to the OLE server. You may have tried to send too much data.

The solution from the Help is to modify the query. I have tried that, but so far I have not come to a solution. Please, I need help!!! I am a beginner and I do not know how else to solve this!!
Jun 6 '07 #1
2 3457
cyberdwarf
218 Expert 100+
When I do the same, but for:
strSQLpst = "SELECT DISTINCT [PST] AS Typ
It plots the PST for all the dates given in the query it is based on.
However, when I introduce the date filter I get the following message:
An error occurred while sending data to the OLE server. You may have tried to send too much data.
Can you post the complete SQL statement please

Steve
Jun 6 '07 #2
Yes, thank you!!! The only difference between the code that works and the one that doesn´t is that on the first one I use only one string, and this value comes from a combo box. In the one that doesn´t work I use a "SELECT DISTINCT" statement (to have distinct values coming from a table) .In both codes the data filter works, but the problem is with the date filter in the second one.

THE CODE THAT WORKS IS THE FOLLOWING:

strSQL = strSQL + " SELECT '" + CStr(cboPST.Value) + "' AS Typ, Sum(([Ende]-[Beginn])*24*60\60) AS Maxi, Avg(([Ende]-[Beginn])*24*60\60) AS Mittel "
strSQL = strSQL + " FROM Motoren WHERE 1=1 "

'DATE FILTER

strSQL = strSQL + " AND [Beginn] >=" + Date_exact_US_SQL(txtVon) + " AND [Beginn] <=" + Date_exact_US_SQL(LDate)

'FOR THE CHART:

strSQL_Dia = "SELECT [Typ],Sum([Maxi]) AS [Laufzeit], Sum([Mittel]) AS [Durchschnitt] FROM (" + strSQL + ") GROUP BY [Typ]"

And works!!!


THE CODE THAT DOESN´T WORK IS:


strSQLabt = "SELECT DISTINCT [Abteilung] AS Typ, Sum(([Ende]-[Beginn])*24*60\60) AS Maxi, Avg(([Ende]-[Beginn])*24*60\60) AS Mittel FROM Motoren WHERE [PST] = '" & Me.cboPST.Value & "' GROUP BY [Abteilung]"

Until here, it does work; it plots all the distinct "Abteilung", but for all the dates coming from the table...when I introduce the code for the date filter:

strSQLabt = strSQLabt & " AND [Beginn] >=" & Date_exact_US_SQL(txtVon) & " AND [Beginn] <=" & Date_exact_US_SQL(LDate)

The data goes through this (no error message) but for the chart:

strSQL_Dia = "SELECT [Typ],Sum([Maxi]) AS [Laufzeit], Sum([Mittel]) AS [Durchschnitt] FROM (" + strSQL + ") GROUP BY [Typ]"

The error says that Typ is not part of the function...and that i am sending too much data. Any ideas?
Jun 6 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Brian Shade | last post by:
Hi all. I am having a bit of a problem with my Perl script and the creation of a chart. I can create the chart and create a new SeriesCollection. I then specify the XValues and the Values parameter...
1
by: Alan | last post by:
Hi there, Are there Excel charting gurus here?? If so then please read on... Sorry for the cross-post but I'm not familiar with the Excel groups. I've posted to asp.general because if I have...
5
by: Alan | last post by:
Hi there, Are there Excel charting gurus here?? If so then please read on... Sorry for the cross-post but I'm not familiar with the Excel groups. I've posted to asp.general because if I have...
6
by: Martin Magnusson | last post by:
I'd like to create my own output streams, in order to be able to redirect output strings to a console, a status window or whatever, depending on the environment. For example, IO::warning << "Bad...
2
by: Homer | last post by:
Hi, Have a quick question: Lets say I have a Hashtable of values hence 56 37.890 1 12.768 5 9.764 etc.... Is there a way for me to draw a chart in C# of this. FYI its actually lottery...
9
by: Patrick.O.Ige | last post by:
I have a code below and its a PIE & BAR CHART. The values now are all static but I want to be able to pull the values from a database. Can you guys give me some ideas to do this? Thanks ...
5
by: Kuna | last post by:
Hi All, I am trying to create a gantt chart in php by getting data from database. I am using WindowsXp OS and having php-4 and my-sql DB. I have installed the JPGRAPH package to my system and...
0
by: rGh | last post by:
Hello, I am trying to create an Excel chart from C#. I am not a very experieced programmer, so my mistake could be very trivial. The code included is a very simple example. I just wanted to...
0
by: CoreyReynolds | last post by:
Hey all, I have a piece of code that dumps a bunch of data into a spreadsheet. Also rearranges it into a pivot table and then graphs the pivot table as well so my boss can get a clear view of the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.