Hi,
I have a SQL2005 proc that returns a row and an output parameter.
On the line that calls QueryForList I get the following exception:
Object cannot be cast from DBNull to other types.
Any help appreciated.
C#
Hashtable ht = new Hashtable();
int id;
int mul;
id = 1;
mul = 0;
ht.Add("id", id);
ht.Add("multiplied", mul);
dataGridView1.DataSource =
Mapper.Instance().QueryForList("getPersonAndOutParameter", ht);
textBox1.Text = Convert.ToInt32(ht["multiplied"]).ToString();
PROC
ALTER PROCEDURE [dbo].[getPersonAndOutParameter]
(
@id integer,
@multiplied integer OUTPUT
)
AS
BEGIN
SET @multiplied = @id * 10
SELECT
per_id,PER_FIRST_NAME,PER_LAST_NAME,PER_BIRTH_DATE,PER_WEIGHT_KG,PER_HEIGHT_M
FROM people
WHERE per_id = @id
RETURN
END
XML
<parameterMap id="getPersonAndOutParameter">
<parameter property="Id" column="id" direction="Input"/>
<parameter property="multiplied" column="multiplied"
direction="Output" type="System.Int32" dbType="Int32"/>
</parameterMap>
<procedure id="getPersonAndOutParameter"
parameterMap="getPersonAndOutParameter" resultMap="SelectAllResult">
getPersonAndOutParameter
</procedure>
--
View this message in context:
http://www.nabble.com/Object-cannot-be-cast-from-DBNull-to-other-types-tp15160273p15160273.html
Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.