If I have for example next select statement in SQL stored procedure:
CREATE PROCEDURE test
as
SELECT 1 as dataNumber
If I read this number with dataReader
Int16 dataNumber
dataNumber=rdr.GetInt16(0);
I get an error - invalid cast.
If I use convert function than it works:
dataNumber=Convert.ToInt16(rdr.GetInt32(0));
Why? It seems that even If I return small number from database (1 in my
case), it consider it as int32.
I would like to do the same without convert function.
Any idea?
regards,S