Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Multiple-step OLE DB Error
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Multiple-step OLE DB Error

 Post Reply Post Reply
Author
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post Topic: Multiple-step OLE DB Error
    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

Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post Posted: 01 November 2004 at 9:08pm
were is line # 48?
Back to Top
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 01 November 2004 at 9:29pm
Print out the variable State
Print out ConvertEmptyToNull(State)
Make sure they are allowed in the database
Back to Top
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.