PDA

View Full Version : Passing nulls or empty strings to SP


xMANIGHTx
07-07-02, 12:08
Is there a simple way to pass a null value or empty string to a Stored Proc parameter?

Say I have:

sqlCmd.Parameters.Append sqlCmd.CreateParameter("@AN_EMAIL_1", adVarChar, adParamInput, Len(strAN_EMAIL_1), strAN_EMAIL_1)

The ASP code won't work if either strAN_EMAIL_1 is "" or null. And this even before of calling the SP. So it won't work to have @AN_EMAIL_1 varchar(50) = NULL defined in the SP

Thanx in advance...

I just had a nasty Idea... trying this: Len(strAN_EMAIL_1)+1 (since I use varchar shouldn't be a problem when I have not empty strings.. will it work?)

xMANIGHTx
07-07-02, 12:13
With Len(...) + 1 it won't work the same...

ADODB.Parameters errore "800a0e7c'

L'oggetto Parameter non è stato definito correttamente. Le informazioni fornite sono incoerenti o incomplete.

(Parameter object it's not defined correctly. Data submitted is incoherent or missing)