How do I pass a null to a stored procedure from VB.Net.
I have tried to pass nothing but that throws an exception.
Here is my parameter
command.Parameters.Add(New SqlParameter("@DLExpiration",
SqlDbType.SmallDateTime, 4, ParameterDirection.Input,
False, 16, 0, _
"DLExpiration", DataRowVersion.Proposed,
DB.getDate(Me.DLExpirationDate.Text)))

Re: Null and Stored Procedure by Neil

Neil
Mon Sep 01 15:39:10 CDT 2003

Try the following:

command.Parameters.Add(New SqlParameter("@DLExpiration",
SqlDbType.SmallDateTime, 4, ParameterDirection.Input,
False, 16, 0, _
"DLExpiration", DataRowVersion.Proposed,
DBNull.Value))


"arne" <arnenospam@garvander.com> wrote in message
news:08a901c370c2$237dd000$a001280a@phx.gbl...
> How do I pass a null to a stored procedure from VB.Net.
> I have tried to pass nothing but that throws an exception.
> Here is my parameter
> command.Parameters.Add(New SqlParameter("@DLExpiration",
> SqlDbType.SmallDateTime, 4, ParameterDirection.Input,
> False, 16, 0, _
> "DLExpiration", DataRowVersion.Proposed,
> DB.getDate(Me.DLExpirationDate.Text)))



Re: Null and Stored Procedure by William

William
Mon Sep 01 19:17:51 CDT 2003

In the SP definition

CREATE PROCEDURE myProc
(inParm1 varchar(20) = 'some default')
AS ...

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"arne" <arnenospam@garvander.com> wrote in message
news:04bc01c370e6$d053d5d0$a301280a@phx.gbl...
> How do I specify a default value of null in a stored
> procedure.
>
> >-----Original Message-----
> >Don't generate the Parameter--don't include it in the
> Parameters list. Of
> >course, this assumes that the SP has a default value for
> the inbound
> >parameter.
> >
> >hth
> >
> >--
> >____________________________________
> >Bill Vaughn
> >MVP, hRD
> >www.betav.com
> >Please reply only to the newsgroup so that others can
> benefit.
> >This posting is provided "AS IS" with no warranties, and
> confers no rights.
> >__________________________________
> >
> >"Neil" <Neil@MSN.net> wrote in message
> >news:bj0alm$g1g$1@newsg4.svr.pol.co.uk...
> >> Try the following:
> >>
> >> command.Parameters.Add(New SqlParameter("@DLExpiration",
> >> SqlDbType.SmallDateTime, 4, ParameterDirection.Input,
> >> False, 16, 0, _
> >> "DLExpiration", DataRowVersion.Proposed,
> >> DBNull.Value))
> >>
> >>
> >> "arne" <arnenospam@garvander.com> wrote in message
> >> news:08a901c370c2$237dd000$a001280a@phx.gbl...
> >> > How do I pass a null to a stored procedure from
> VB.Net.
> >> > I have tried to pass nothing but that throws an
> exception.
> >> > Here is my parameter
> >> > command.Parameters.Add(New SqlParameter
> ("@DLExpiration",
> >> > SqlDbType.SmallDateTime, 4, ParameterDirection.Input,
> >> > False, 16, 0, _
> >> > "DLExpiration",
> DataRowVersion.Proposed,
> >> > DB.getDate(Me.DLExpirationDate.Text)))
> >>
> >>
> >
> >
> >.
> >