473,385 Members | 1,769 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,385 software developers and data experts.

Problem with Datagrid and SQL sentence

Hi,

We are developing a Visual Net application and we found a problem using a
datagrid with a SQL sentence that
includes the HAVING clause.

Does somebody know if exist any bug with this clause, if yes how can we do?

The SQL sentence is:

SELECT a.ORDENTRABAJO,a.DESORDENTRABAJO,Count(a.EQUIPO) AS TotalEquipos FROM
WK_OTSAP_PUENTE a
WHERE a.REALIZADA='1'
GROUP BY a.ORDENTRABAJO,a.DESORDENTRABAJO
HAVING (Count(a.EQUIPO))=(SELECT Count(*) AS total FROM WK_OTSAP_PUENTE
WHERE ordentrabajo=a.ordentrabajo)

In we run the sql sentence in the databse the result is correct, but the
datagrid shows null in each row,
althought the row number is correct!!! Without "HAVING" the datagrid runs OK

Thanks in advance
Jul 21 '05 #1
1 1179
Can you change the SQL statement to a WHERE clause instead of HAVING?
Something like

SELECT a.ORDENTRABAJO,a.DESORDENTRABAJO,Count(a.EQUIPO) AS TotalEquipos FROM
WK_OTSAP_PUENTE a
WHERE a.REALIZADA='1' AND
Count(a.EQUIPO))=(SELECT Count(*) AS total FROM WK_OTSAP_PUENTE
WHERE ordentrabajo=a.ordentrabajo)
GROUP BY a.ORDENTRABAJO,a.DESORDENTRABAJO

I can't test it, but I think the above should work. :)

--
Ben Strackany
www.developmentnow.com
"ManelBIS" <Ma******@discussions.microsoft.com> wrote in message
news:B4**********************************@microsof t.com...
Hi,

We are developing a Visual Net application and we found a problem using a
datagrid with a SQL sentence that
includes the HAVING clause.

Does somebody know if exist any bug with this clause, if yes how can we do?
The SQL sentence is:

SELECT a.ORDENTRABAJO,a.DESORDENTRABAJO,Count(a.EQUIPO) AS TotalEquipos FROM WK_OTSAP_PUENTE a
WHERE a.REALIZADA='1'
GROUP BY a.ORDENTRABAJO,a.DESORDENTRABAJO
HAVING (Count(a.EQUIPO))=(SELECT Count(*) AS total FROM WK_OTSAP_PUENTE
WHERE ordentrabajo=a.ordentrabajo)

In we run the sql sentence in the databse the result is correct, but the
datagrid shows null in each row,
althought the row number is correct!!! Without "HAVING" the datagrid runs OK
Thanks in advance

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matthew Woods | last post by:
Hi, is there any way to format and order the columns displayed in a datagrid bound to a class that inherits from IBindingList? i have used DataGridTableStyle and added DataGridTextBoxColumns to it...
2
by: scorpion53061 | last post by:
I have only built windows applications up to this point using vb.net. A situation arose where I needed to do some web work so I decided to try ASP.NET on my local machine. Everything worked okay...
5
by: jason | last post by:
Hi, all How can I update data (multiple rows, but not every rows) using dataset in datagrid? I mean is there any way I can let datagrid know which row(s)/column(s) has been modified and update...
1
by: ManelBIS | last post by:
Hi, We are developing a Visual Net application and we found a problem using a datagrid with a SQL sentence that includes the HAVING clause. Does somebody know if exist any bug with this...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.