Home All Groups Group Topic Archive Search About

Null in a Column when there is data

Author
30 Apr 2006 4:06 AM
John Mark Howell
I'm running .Net v1.1, C# against a SQL Server 2000 db.
I've got a stored procedure that returns multiple columns.  All but the
first column are numeric(18,6).  I have the standard
SqlConnection/SqlCommand/SqlDataAdapter calls to retrieve the data and
simply display in a DataGrid.  The first three numeric columns are all null
and many of the others appear to be null.  However, when I run the same
query in the Query Analyzer, all the data is coming back.   I have even
checked one of the columns (eg. dataSet.Tables[0].Rows[0][2]) and it returns
System.DBNull when I know there is data there.  Anybody have any ideas???

--
John Mark Howell
blog: http://jmarkhowell.blogspot.com/

Author
1 May 2006 1:38 AM
John Mark Howell
I just wanted everyone to know that the bug was really in the stored proc.
There was a subtle SQL error that does not show itself when you execute the
proc through Query Analyzer but does when you call it form SqlClient.  Just
one more fun thing to watch out for. :)

--
John Mark Howell
blog: http://jmarkhowell.blogspot.com/
Show quote
"John Mark Howell" <jmarkhow***@hotmail.com> wrote in message
news:uhQvBuAbGHA.996@TK2MSFTNGP04.phx.gbl...
> I'm running .Net v1.1, C# against a SQL Server 2000 db.
> I've got a stored procedure that returns multiple columns.  All but the
> first column are numeric(18,6).  I have the standard
> SqlConnection/SqlCommand/SqlDataAdapter calls to retrieve the data and
> simply display in a DataGrid.  The first three numeric columns are all
> null and many of the others appear to be null.  However, when I run the
> same query in the Query Analyzer, all the data is coming back.   I have
> even checked one of the columns (eg. dataSet.Tables[0].Rows[0][2]) and it
> returns System.DBNull when I know there is data there.  Anybody have any
> ideas???
>
> --
> John Mark Howell
> blog: http://jmarkhowell.blogspot.com/
>

AddThis Social Bookmark Button