Null in a Column when there is data

J

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???
 
J

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. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top