Home All Groups Group Topic Archive Search About

Error: The SqlDbType enumeration value, 4, is invalid.

Author
24 Jun 2006 1:22 PM
Ben Fidge
Hi

I'm getting an error which says "The SqlDbType enumeration value, 4, is
invalid." when calling one of my stored procedures. The SP doesn't actually
take any parameters and my C# code doesn't attempt to pass it any.

SqlDbType value 4 is actually SqlDbType.DateTime.

My SP simply retrieves a list of the most common Shows sold over a period of
the last 31 days

My procedure is as follows:

CREATE PROCEDURE [dbo].[prcTheatres_GetTop5ShowsAsListItem]

as

select UKey, Description as Text from dbo.vwTheatres_Shows where UKey in

(select top 5 UKeyShow from dbo.Theatres_Bookings

inner join dbo.vwTheatres_Shows on dbo.vwTheatres_Shows.UKey =
dbo.Theatres_Bookings.UKeyShow

where Date_Time_Entered > GetDate() - 31 group by UKeyShow order by Count(*)
desc)

Author
24 Jun 2006 1:32 PM
Ben Fidge
Also have the following error in our Event Log:

"The SqlDbType enumeration value, 100, is invalid."

When calling the same procedure.

These errors don't appear to be consistent or follow any kind of pattern.

Really confused!!

Ben



Show quote
"Ben Fidge" <nospam@nospam.com> wrote in message
news:egPSVG5lGHA.4076@TK2MSFTNGP05.phx.gbl...
> Hi
>
> I'm getting an error which says "The SqlDbType enumeration value, 4, is
> invalid." when calling one of my stored procedures. The SP doesn't
> actually take any parameters and my C# code doesn't attempt to pass it
> any.
>
> SqlDbType value 4 is actually SqlDbType.DateTime.
>
> My SP simply retrieves a list of the most common Shows sold over a period
> of the last 31 days
>
> My procedure is as follows:
>
> CREATE PROCEDURE [dbo].[prcTheatres_GetTop5ShowsAsListItem]
>
> as
>
> select UKey, Description as Text from dbo.vwTheatres_Shows where UKey in
>
> (select top 5 UKeyShow from dbo.Theatres_Bookings
>
> inner join dbo.vwTheatres_Shows on dbo.vwTheatres_Shows.UKey =
> dbo.Theatres_Bookings.UKeyShow
>
> where Date_Time_Entered > GetDate() - 31 group by UKeyShow order by
> Count(*) desc)
>
>
>
>
Author
26 Jun 2006 10:50 PM
Simon Whale
as far as i can see your issue it with the line that states

"where Date_time_entered > getdate() -31"

to go 31 days into the past use the following

where date_time_entered > dateadd(dd,-13,getdate())

Simon

Show quote
"Ben Fidge" <nospam@nospam.com> wrote in message
news:evKSuL5lGHA.508@TK2MSFTNGP03.phx.gbl...
> Also have the following error in our Event Log:
>
> "The SqlDbType enumeration value, 100, is invalid."
>
> When calling the same procedure.
>
> These errors don't appear to be consistent or follow any kind of pattern.
>
> Really confused!!
>
> Ben
>
>
>
> "Ben Fidge" <nospam@nospam.com> wrote in message
> news:egPSVG5lGHA.4076@TK2MSFTNGP05.phx.gbl...
>> Hi
>>
>> I'm getting an error which says "The SqlDbType enumeration value, 4, is
>> invalid." when calling one of my stored procedures. The SP doesn't
>> actually take any parameters and my C# code doesn't attempt to pass it
>> any.
>>
>> SqlDbType value 4 is actually SqlDbType.DateTime.
>>
>> My SP simply retrieves a list of the most common Shows sold over a period
>> of the last 31 days
>>
>> My procedure is as follows:
>>
>> CREATE PROCEDURE [dbo].[prcTheatres_GetTop5ShowsAsListItem]
>>
>> as
>>
>> select UKey, Description as Text from dbo.vwTheatres_Shows where UKey in
>>
>> (select top 5 UKeyShow from dbo.Theatres_Bookings
>>
>> inner join dbo.vwTheatres_Shows on dbo.vwTheatres_Shows.UKey =
>> dbo.Theatres_Bookings.UKeyShow
>>
>> where Date_Time_Entered > GetDate() - 31 group by UKeyShow order by
>> Count(*) desc)
>>
>>
>>
>>
>
>
Author
24 Jun 2006 3:56 PM
Earl
What sort of result do you get in QA? First glance says to suspect GetDate,
since you are doing mathematical computations on a datetime. Try casting or
converting the date before doing the math.

Show quote
"Ben Fidge" <nospam@nospam.com> wrote in message
news:egPSVG5lGHA.4076@TK2MSFTNGP05.phx.gbl...
> Hi
>
> I'm getting an error which says "The SqlDbType enumeration value, 4, is
> invalid." when calling one of my stored procedures. The SP doesn't
> actually take any parameters and my C# code doesn't attempt to pass it
> any.
>
> SqlDbType value 4 is actually SqlDbType.DateTime.
>
> My SP simply retrieves a list of the most common Shows sold over a period
> of the last 31 days
>
> My procedure is as follows:
>
> CREATE PROCEDURE [dbo].[prcTheatres_GetTop5ShowsAsListItem]
>
> as
>
> select UKey, Description as Text from dbo.vwTheatres_Shows where UKey in
>
> (select top 5 UKeyShow from dbo.Theatres_Bookings
>
> inner join dbo.vwTheatres_Shows on dbo.vwTheatres_Shows.UKey =
> dbo.Theatres_Bookings.UKeyShow
>
> where Date_Time_Entered > GetDate() - 31 group by UKeyShow order by
> Count(*) desc)
>
>
>
>

AddThis Social Bookmark Button