SqlDbType enumeration error

Hi,

When the sub below here is called on my visual studio localhost, there is 
not a single problem.
When I run my website with this sub on my IIS server I get the following 
error which doesn't make sence at all:

The SqlDbType enumeration value, 31, is invalid.
Parameter name: SqlDbType 
Description: An unhandled exception occurred during the execution of the 
current web request. Please review the stack trace for more information about 
the error and where it originated in the code. 

Exception Details: System.ArgumentOutOfRangeException: The SqlDbType 
enumeration value, 31, is invalid.
Parameter name: SqlDbType


Here is my code:

Public Function setApproval(ByVal month As String, ByVal user As String) As 
Boolean
    Dim conn As New SqlClient.SqlConnection
    conn = ConnectToSQLdb()
    If conn Is Nothing Then
      Return False
      Exit Function
    End If
    Dim dMonth As Date = CDate("01 " + month)

    Dim sb As New StringBuilder
    sb.AppendLine("UPDATE " & SQLTable.TimeSheetData)
    sb.AppendLine("SET " & TimeS.Approved & " = 'True', " & 
TimeS.ApprovalDate & " = @approvalDate")
    sb.AppendLine("WHERE MONTH(" & TimeS.Datum & ")=@maand AND YEAR(" & 
TimeS.Datum & ")=@jaar AND " & TimeS.EmployeeNummer & "=@employeenr")
    myCMD = New SqlCommand(sb.ToString, conn)

    myCMD.Parameters.Add("@approvaldate", SqlDbType.Date).Value = Now
    myCMD.Parameters.Add("@maand", SqlDbType.Int).Value = dMonth.Month
    myCMD.Parameters.Add("@jaar", SqlDbType.Int).Value = dMonth.Year
    myCMD.Parameters.Add("@employeenr", SqlDbType.NVarChar, 15).Value = user

    Try
      myCMD.ExecuteNonQuery()
    Catch ex1 As Exception
      myError = "There was a problem with setting the approvedfield in the 
database!"
      conn.Close()
      Return False
    End Try
    conn.Close()
    Return True
  End Function

How can I solve this?
What is causing it?

rg,
Eric

2
Utf
2/17/2010 4:19:02 PM
sqlserver.server 1327 articles. 0 followers. Follow

1 Replies
2284 Views

Similar Articles

[PageSpeed] 42

On 2010-02-17 17:19, Eric wrote:
> When the sub below here is called on my visual studio localhost, there is
> not a single problem.
> When I run my website with this sub on my IIS server I get the following
> error which doesn't make sence at all:
>
> The SqlDbType enumeration value, 31, is invalid.
> Parameter name: SqlDbType
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information about
> the error and where it originated in the code.
>
> Exception Details: System.ArgumentOutOfRangeException: The SqlDbType
> enumeration value, 31, is invalid.
> Parameter name: SqlDbType
>
>
<snip>
>      myCMD.Parameters.Add("@approvaldate", SqlDbType.Date).Value = Now

You're using the new Date type, which is only supported from SQL Server 2008 
and .NET 2.0 SP1 onwards. The server likely has the pre-SP1 .NET 2.0 
installed. You'll want to install .NET 3.5, which also updates the 2.0 CLR 
to SP2.

You might also have made a simple typo if you're *really* using a DATETIME 
field (which is supported in all versions of SQL Server).

-- 
J.
0
Jeroen
2/17/2010 6:46:27 PM
Reply:

Similar Artilces:

Outlook 2000 Error Message #4
When I attempt to open my inbox I get the following error message. Unable to expand the folder. The set of folders could not be opened. The Exchange Server has detected that you are using an old copy of your OST file. Please delete your OST file and create a new one from the server. Do a search on your C:\ drive for *.ost, rename outlook.ost to outlook.001. When you open Outlook, a new *.ost file will be created. >-----Original Message----- >When I attempt to open my inbox I get the following error >message. >Unable to expand the folder. The set of folders could not >...

Blank Distribution Accounts
Hi! Was wondering if any of you came across this problem in GP. Have a client who was able to post transactions from AP with NO account distributions. The system did not give them any errors in the subledger. When they tried to post the batches in GL, that's when they received errors about the missing distribution accounts. When they drill back on the AP transactions, the amounts are there but the accounts are all blank. Any ideas? The client is on GP 7.5. Thanks Marisol ...

Reserved error (-1524); there is no message for this error.
I am trying to run a pretty simple select query in Access 2007, and I keep getting the error message "Reserved error (-1524); there is no message for this error." There are no linked tables in the database - the design of the database is very simple. I should also note that I ran the "compact and repair database" tool and I am still getting the same error message. I don't think I'm using any reserved words...Here is the SQL: SELECT E_CURRENT_DATA.Prefix, E_CURRENT_DATA.LastName, E_CURRENT_DATA.FirstName, E_CURRENT_DATA.Address, E_CURRENT_DATA.City, E_CURRENT_DATA...

Sa Login Error
Dear All, Recently on our test machine the password for sa was rest in the db. Now when I am trying to connect to my CRM application it is giving me an error, which in event viewer is : --------------------- Event Type: Error Event Source: RLSERVICE Event Category: None Event ID: 0 Date: 6/22/2008 Time: 11:47:46 AM User: N/A Computer: SERVER02 Description: Start: Login failed for user 'sa'. ----------- How can this be resolved? ...

Macro-error 400- macro doesn't work on other computer
I sent an excel workbook to another computer. On that computer, I created a macro button and assigned the macro to it (which is in "This Workbook"), but I get "400" error show up and the macro doesn/t work. Do I have the macro in the wrong place? Joe I seached the VBA help for "trappable errors" and found this for 400: Form already displayed; can't show modally (Error 400) You can't use the Show method to display a visible form as modal. This error has the following cause and solution: You tried to use Show, with the style argument set to 1 � vbMod...

Error when switch off
Please help! When I use outlook 2003 on Win XP pro, when I switch off the window appear the error but the window can not recognize. And the window need report to Microsoft. Please help!!! Best regards, Q. Tuan (Vietnam) tuan@dulon.com.vn <anonymous@discussions.microsoft.com> wrote: > When I use outlook 2003 on Win XP pro, when I switch off > the window appear the error but the window can not > recognize. And the window need report to Microsoft. What do you mean by "switch off the Window"? What do you mean by "window cannot recognize"? I realize you&...

Socket Error when sending / recieving mail
Hello, This is a problem that has progressively gotten worse these past week. The error message that began appearing Monday of this week and has intermitenly gotten worse. It started Monday when 1/5 of my home email accounts gave me this error Every day since, this error has changed accounts that have the error leading up to today. EVERY account I have now, 5/5, is recieving this error evry time I try to recieve mail or send the message error is as follows: The connection to the server has failed. Account: 'pop-server.wi.rr.com (1)', Server: 'pop-server.wi.rr.com', Protocol...

SMTP Error #5
Hi , I am using E2k3 with SP1. While sending a mail to some email ids i get the error that domain isn't in my list of allowed rcpthosts (#5.7.1)> Can any one tell me why i am getting this error and what is the solution to send the mails on these email ids. Regards, Abhi. 5.7.1 is an error from the recipient server that indicates it is unwilling to relay the mail to the destination. I've seen this happen sometimes when DNS resolution is failing and incorrect hosts are chosen as the destination for mail for a particular domain. "abhishek pandey" <pandeyabhishek2...

SqlDbType enumeration error
Hi, When the sub below here is called on my visual studio localhost, there is not a single problem. When I run my website with this sub on my IIS server I get the following error which doesn't make sence at all: The SqlDbType enumeration value, 31, is invalid. Parameter name: SqlDbType Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentOutOfRangeException: The SqlDbType enumeration value,...

Microsoft Document Connection gives error "Only connections to SharePoint or SkyDrive servers are supported."
Trying to connect to my SharePoint server using Microsoft Document Connection with Mac Office 2011. Getting this frustrating error: "Only connections to SharePoint or SkyDrive servers are supported." I have the full version of Mac Office 2011 (not student/teacher edition) and am running MOSS 2007 Service Pack 2 (12.0.0.6421) on my server. I have no problem connecting to SharePoint using anything else. Does anyone have any ideas? I have tried the basic authentication option, too but this has has no effect. Thanks in advance! Toby On Jan 25, 8:22=A0pm, Toby <tobybore...@gmail...

XmlSerializer & Signed Assemblies : CS0647 Compilation Error
Hi, I am having problems using the XmlSerializer from within a signed assembly. I have narrowed down the problem to a compilation error (CS0647) occuring when .NET tries to compile code generated by the XmlSerializer. The JIT compiler gives an error when trying to process the following attribute: - [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")]. To make matters worse, this problem is intermittent. I have seen various postings around the web which seem to indicate that other people have experienced this same ...

Concatenate error/problem
Hi All, Who can help me with this problem>>?? I have to concatenate 5 items (and between all items an ", " (comma)), which I let lookup from a list containing 24 rows. This is what I'm using: =CONCATENATE((VLOOKUP(B28,I30:N54,6,0)),", ",(VLOOKUP(B32,I30:N54,6,0)),", ",(VLOOKUP(B36,I30:N54,6,0)),", ",(VLOOKUP(B40,I30:N54,6,0)),", ",(VLOOKUP(B44,I30:N54,6,0)),".") In some cases my lookup value is empty... Now I get a #N/A error How can I do this right. Example: If all my lookup value are filled I get this: 1000, 2000, 3000, ...

Serious Error
I am running XP Professional and Office XP. I set up a Limited Account for my daily use and an Admin Account. Since I have set up the Limited Account, I have started getting a message that my Modem interface has experienced a serious error and must close. Usually this happens after checking email in Outlook with the Limited Account. I have both accounts set up the same with email etc. I am not sure what I did wrong that I keep getting this error. I know that I was in the wrong account when I went to update my modem drivers--was in Limited account instead of Admin account when I expanded ...

Runtime Error
In a previous post, more details about the Runtime Error Alert that I receive was requested for further diagnosing of the problem I am experiencing with Outlook 2003. I have since received the error again... The problem that I have is that, whenever Outlook performs "heavy tasks," such as receiving or sending large or ample messages or processing rules, it abruptly shuts down. This originally was occurring on just one computer, but is now occurring on both of them. I originally was receiving the Runtime Error Alerts when this abrupt shut down occurred, then they wen...

public folder enumeration
Not sure why my last post fell as a reply or subpost to a previous message but here goes attempt two: Is there a way to enumerate all folders and posts (including attachment labels where applicable) and redirect to a text file or CSV in a similar fashion that the DOS tree /F /A command would work? Thanks! ...

New Top-Level Site
SBS 2003 R2 with WSS 2.0 Created a new top-level site but we cannot access it due to the following errors: You are not authorized to view this page You do not have permission to view this directory or page using the credentials that you supplied. -------------------------------------------------------------------------------- Please try the following: Contact the Web site administrator if you believe you should be able to view this directory or page. Click the Refresh button to try again with different credentials. HTTP Error 401.1 - Unauthorized: Access is denied du...

if error
i have a macro that reads from a list of data which is autoimaticall generated, some times the error #DIV0! is produced i want to write if cell.value=this error then set variable to zero how do i do this -- Message posted from http://www.ExcelForum.com as always, post your coding efforts for comments -- Don Guillett SalesAid Software donaldb@281.com "robert_woodie >" <<robert_woodie.15j2vv@excelforum-nospam.com> wrote in message news:robert_woodie.15j2vv@excelforum-nospam.com... > i have a macro that reads from a list of data which is autoimatically > generat...

error opening explorer
All of a sudden Every time I open Explorer I get this error problem: signature: Problem Event Name: APPCRASH Application Name: iexplore.exe Application Version: 8.0.7600.16385 Application Timestamp: 4a5bc69e Fault Module Name: Flash10c.ocx Fault Module Version: 10.0.32.18 Fault Module Timestamp: 4a613d79 Exception Code: c0000005 Exception Offset: 001a8ade OS Version: 6.1.7600.2.0.0.768.3 Locale ID: 1033 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4:...

Publisher open file error
Upgrated a user to Publisher 2003 (SP2) from Publisher2002(SP3). No get this message: "Publisher cannot open this file. This file ma have been corrupted during download. Tried opening under Pub2002, crashes the program I don't think it is a version problem because other PC's with Pub200 can open old and new pub files. There was not a problem when thi file was last saved... however maybe it is just plain hosed Did not find any reference at MS, or any web or forum searches to th above error message. Any ideas or is this user's file unrecoverable (FYI - not using Norton AV etc......

error recovery screen
I'm stuck in the windows error recovery screen and I can't get out of it. I was getting a bunch of error messages saying that applications failed then got the blue screen with the system repair message. After I attempted to go through the system repair, I got the message that the root problem was the registry being corrupt and to restart the computer to allow windows to repair the problem. I did that and got the windows error recovery screen giving me two options of doing a system repair or to start windows normally. I went through other threads and tried to go to the BIO...

Error inserting clip art, etc.
Every time I try to insert clip art, etc. (with '97 version) I get the error message: "Publisher cannot launch or communicate with the OLE server program needed to complete this task. There may not be enough disk space, or there may be a problem with the server program. To make more disk space available, delete some unneeded files on your hard disk. If you suspect a problem with the server program, try reinstalling it. Then try this task again." I have removed and reinstalled publisher and still get the same error message. Any other ideas? There are a few things you can...

HOW TO LOCATE SCAN PST ERRORS?
I frequently get a warning that Outlook needs to find file errors. Scan.pst also finds errors that it says are "minor". I'm not getting an "error" folder of any kind. How can I determine which entries/mail items/etc. are causing the errors so that I can deal with them and eliminate the problem permanently? Windows Vista. Office 2007. Thank you. It's more likely an add-in or something else accessing the pst that is causing the corruption by not allowing outlook is close completely. Make sure Outlook is not listed in Task Manager, Processes tab a few m...

error:
when attempting to sync my pocket pc w/ outlook 2002 (windows xp-prof), i get two messages from outlook: 1. (microsoft outlook): no profiles have been created. to create a new profile, use the mail icon in the control panel. then i press ok, and i get the following: 2.(microsoft outlook syncronization): sync. cannot be completed because your personal information manager is not running. ensure your pim program is running, and try to syncronyze again. if your pim program is running, restart your desktop computer. i had created those profiles, but the problem persist. please advice. t...

Enumerated Constants
Is there an enumerated constant that defines the maximum number of characters that can be displayed in a cell, e.g., "xlMaxChars" (I just made this one up). There is no such constant. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Jon" <jon.lark@L-3Com.com> wrote in message news:O%23m7hny1EHA.1452@TK2MSFTNGP11.phx.gbl... > Is there an enumerated constant that defines the maximum number > of > characters that can be displayed in a cell, e.g., "xlMaxChars" > (I just made > this one ...

Payables Dist. Errors
Bonjour! We are having problems in our test company with the payables. Our test company have been created at the begining of the implementation but to update it, I simply do a backup of our real company and restore it on the test company. In the payables I create a new payables transaction entry and my distribution is Ok before I click on save. When I do save I receive and error "this transaction will not post; it includes distribution with errors. But the distribution is OK, 500 debit 500 credit no remaining balance. In the real company I don't have that problem. Regards, Joe...