Re: Problem with Datagrid and SQL sentence
From: Ben Strackany (infoNOSPAM_at_developmentnow.nospam.com)
Date: 01/05/05
- Next message: John Spiegel: "Re: question about a phrase"
- Previous message: Kenneth: "Why is it neccesary to include SqlDbType to the SqlParameter?"
- In reply to: ManelBIS: "Problem with Datagrid and SQL sentence"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 5 Jan 2005 11:02:53 -0600
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" <ManelBIS@discussions.microsoft.com> wrote in message news:B4F681B6-CC3B-4608-906C-668A4266C128@microsoft.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
- Next message: John Spiegel: "Re: question about a phrase"
- Previous message: Kenneth: "Why is it neccesary to include SqlDbType to the SqlParameter?"
- In reply to: ManelBIS: "Problem with Datagrid and SQL sentence"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|