Pawel W.


Hi,

Becouse some of my stored procedure parameters can be NULL, for every parameter with potential NULL value I have to do checking like this:

errorParams[3].Value = (e.InnerException==null) (object)DBNull.Value:(object)e.InnerException;

When I do it like this ( it is a part of preparing values for insert ):

errorParams[3].Value = e.InnerException

no row is added. Is there any way to pass over that check : (e.InnerException==null) (

and do it easier

 

This the sample exception message for that issue:

{System.Data.SqlClient.SqlException: Procedure or Function 'sp_addError' expects parameter '@InnerException', which was not supplied.

Thanks,

Pawe




Re: INSERTING NULL VALUES VIA STORED PROCEDURES

Jens K. Suessmeyer


That depends on your Procedure declaration, you will have to allow a default parameter in orde to let it work.

CREATE PROCEDURE sp_addError
(
@InnerException VARCHAR(1000) = NULL --Which declares the default if no value is passed through
)
(...)

HTH, Jens K. Suessmeyer.

---
http://www.sqlserver2005.de
---





Re: INSERTING NULL VALUES VIA STORED PROCEDURES

Pawel W.

Cool :) Big thanks!

Pawe






Re: INSERTING NULL VALUES VIA STORED PROCEDURES

m_3ryan

Thank you very much
It was solution of my Big problem