Problem using SQLDataReader with Sybase ASE

Posted by John K. on Stack Overflow See other posts from Stack Overflow or by John K.
Published on 2011-01-05T21:49:03Z Indexed on 2011/01/05 21:53 UTC
Read the original article Hit count: 269

Filed under:
|
|
|

We're developing a reporting application that uses asp.net-mvc (.net 4). We connect through DDTEK.Sybase middleware to a Sybase ASE 12.5 database.

We're having a problem pulling data into a datareader (from a stored procedure). The stored procedure computes values (approximately 50 columns) by doing sums, counts, and calling other stored procedures.

The problem we're experiencing is... certain (maybe 5% of the columns) come back with NULL or 0. If we debug and copy the SQL statement being used for the datareader and run it inside another SQL tool we get all valid values for all columns.



conn = new SybaseConnection
{
     ConnectionString = ConfigurationManager.ConnectionStrings[ConnectStringName].ToString()
};
conn.Open();

cmd = new SybaseCommand
{
     CommandTimeout = cmdTimeout,
     Connection = conn,
     CommandText = mainSql
};


reader = cmd.ExecuteReader();
// AT THIS POINT IMMEDIATELY AFTER THE EXECUTEREADER COMMAND
// THE READER CONTAINS THE BAD (NULL OR 0) DATA FOR THESE COLUMNS.

DataTable schemaTable = reader.GetSchemaTable();
// AT THIS POINT WE CAN VIEW THE DATATABLE FOR THE SCHEMA AND IT APPEARS CORRECT
// THE COLUMNS THAT DON'T WORK HAVE SPECIFICATIONS IDENTICAL TO THE COLUMNS THAT DO WORK 



Has anyone had problems like this using Sybase and ADO?


Thanks, John K.

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-mvc