This scenario usually arises when the data is not 'received' properly from the database.
Check this link ( shahriarnk.com/Shahriar-N-K-Research-Embedding-SQL-in-C-Sharp-Java.html ) for details on how to connect to SQL Server
database from C#.NET database applications as well as Java database applications. It also describes how to pass embedded SQL queries, calling stored procedures, pass parameters etc.
Shahriar Nour Khondokar: shahriarnk.com/