General information
Category:
Coding, syntax and commands
I've run the select from within SSMS
"SELECT SUM(CALLCOUNT) AS CALLS FROM BI.dbo.BI01 WHERE " +
"WEEKNO = ? AND SUBSTRING(LOC, 1, 2) = ?";
and if no records are selected , one record is returned with NULL in CALLS field... so this expalins the eror message
When I issue the same SQL select in VFP, no records are returned, which I was assuming would have been the same in SQL Server
Regards,
gerard
>Hi Viv
> rdrCount["CALLS"].ToString() shows a Blank
>
>The select string is:
>
>"SELECT SUM(CALLCOUNT) AS CALLS FROM BI.dbo.BI01 WHERE " +
> "WEEKNO = ? AND SUBSTRING(LOC, 1, 2) = ?";
>
>So it seems that just one record is selected but a blank ends ub in CALLS... I would have thought that a zero should be there ?
>
>Regards,
>Gerard
>
>
>
>
>>>I have code like:
>>> OleDbDataReader rdrCount = cmdCount.ExecuteReader();
>>> and a while (rdrCount.Read())
>>>
>>>The rdrCount just has a Select String
>>>
>>>Now the rdrCount.HasRows returns true, but the rdrCount.recordsAffected returns -1
>>>...and in my reader loop I get an InvalidOperation exception from a ..
>>> x=Convert.ToInt32(Convert.ToDouble(rdrCount["CALLS"].ToString().Trim()))
>>>
>>>Would the recordsAffected not return a positive number if the HasRows is true ?
>>>Also, I cant seem to see anywhere in debug the column data in rdrCount
>>>(I suspect this is because the rdrCount["CALLS"] has an unexpected data type in there)
>>> but where can is see rdrCount["CALLS"] in debug mode
>>
>>I think RowAffected is always -1 for a Select.
>>What does a simple rdrCount["CALLS"].ToString() show?
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only