Print Page | Close Window

Multiple-step OLE DB Error

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=12404
Printed Date: 30 March 2026 at 9:50pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Multiple-step OLE DB Error
Posted By: Misty
Subject: Multiple-step OLE DB Error
Date Posted: 01 November 2004 at 2:34pm

I need some help. I am very frustrated because I keep on getting the following error message when I try to update information:

Microsoft OLE DB Provider for SQL Server error '80040e21'

Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

/UpdateCity.asp, line 48

I don't have this problem with Access. Can someone tell me how I can fix my code to make sure that it will allow me to update certain information as much as I want to?

Here's my code:

'----------------------------------------------------------- --

' name: UpdateRecord()

' description: Update the record

' note: This converts all empty strings to Null values

'----------------------------------------------------------- ---

Sub UpdateRecord()

          

    'Get values for new record

    AreaName = Request.Form("selArea")

    City = Request.Form("txtCity")

    State = Request.Form("txtState")

   

    

      'Fill in recordset field values, while converting all

      'empty strings to Null values

      rs("AreaID") = ConvertEmptyToNull(AreaName)

      rs("City") = ConvertEmptyToNull(City)

      rs("State") = ConvertEmptyToNull(State)

                

      'Save the record to the database

      rs.Update

End Sub

' ------------------------------------------------------------ ----

' name: ConvertEmptyToNull(theString)

' description: Converts empty strings to NULL to save those values

' to a database.

' returns: NULL if the string passed in is empty

' the original string if it was not empty

' ------------------------------------------------------------ -----

Function ConvertEmptyToNull(theString)

      dim convertedString

      If theString = "" then

           convertedString = Null

      Else




Replies:
Posted By: Phat
Date Posted: 01 November 2004 at 9:08pm
were is line # 48?


Posted By: Misty
Date Posted: 01 November 2004 at 9:13pm

rs("State") = ConvertEmptyToNull(State)

I have this same problem with other web pages that attempt to update information in the database from a form. I think that I need some code to allow me to update as much as I want to. It is a SQL Server problem.



Posted By: Gullanian
Date Posted: 01 November 2004 at 9:29pm
Print out the variable State
Print out ConvertEmptyToNull(State)
Make sure they are allowed in the database


Posted By: Misty
Date Posted: 01 November 2004 at 9:55pm
My database allows nulls for the state field. This is not the problem. I think that I need to fix my code to allow the database to be updated based on information from the form. I have the very same problem with other forms that allow you to edit the information. Does anyone have any ideas on how I can solve this problem?


Posted By: Phat
Date Posted: 02 November 2004 at 12:26am
try to commet out that line and see if it updates OK. If it does it is an issue with the field type or what your putting in to it.



Posted By: Misty
Date Posted: 02 November 2004 at 1:39am
I found out what is wrong. I went to look at the State field in my database. It was a char datatype. The length was 2. I changed it to nvarchar. I also changed the length to 50. For some reason, I got the error message when I just had the length size to 2. I wonder why this happened.


Posted By: Phat
Date Posted: 02 November 2004 at 4:59am
if the length is 2 and you try to put 3 or more chars in it, it will give this error.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net