Run-Time Error '-2147217842(80040e4e)

Thread Solved

Join Date: Nov 2008
Posts: 5
Reputation: realnapstar is an unknown quantity at this point 
Solved Threads: 0
realnapstar realnapstar is offline Offline
Newbie Poster

Run-Time Error '-2147217842(80040e4e)

 
0
  #1
Nov 17th, 2008
hello all

i am facing a problem when i try to add new records in to data base. first of all my tech details are given below

Front end - vb 6
Back end - Microsoft SQL Server 2000

i am connecting to sql through ADODB connection ( through code ). my purpose is when i click on the "ok" button then the records entered in my form will add to the database. but when i click on the ok button then a errors comes saying

" Run-time error '-2147217840(80040e4e)'
operation was canceled "

and the error is highlighted in adorset.Move 0

my code is like this

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. If (MsgBox("Are You Sure? You Want to Save The Record?", vbYesNo) = vbYes) Then
  2. adorset.Move 0
  3. adorset.Update
  4. MsgBox "Record Saved"
  5. Call rsEmpC
  6. Call constateC
  7. Unload Me
  8. End If
  9. End Sub

one of the funniest thing is that if we press debug and run in regular base the record will be saved in to the table

please help me
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 710
Reputation: Teme64 will become famous soon enough Teme64 will become famous soon enough 
Solved Threads: 114
Teme64's Avatar
Teme64 Teme64 is offline Offline
Master Poster

Re: Run-Time Error '-2147217842(80040e4e)

 
0
  #2
Nov 17th, 2008
Do you need adorset.Move 0 ?
However, you do have a connection object. Check from the connection object which is the native error and description
oConn.Errors(0).NativeError
oConn.Errors(0).Description
where oConn is your connection object.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 5
Reputation: realnapstar is an unknown quantity at this point 
Solved Threads: 0
realnapstar realnapstar is offline Offline
Newbie Poster

Re: Run-Time Error '-2147217842(80040e4e)

 
0
  #3
Nov 18th, 2008
thanks for your replay
i need "move 0" because of another error please check this link and help me to solve it

http://support.microsoft.com/kb/q195638/
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 710
Reputation: Teme64 will become famous soon enough Teme64 will become famous soon enough 
Solved Threads: 114
Teme64's Avatar
Teme64 Teme64 is offline Offline
Master Poster

Re: Run-Time Error '-2147217842(80040e4e)

 
0
  #4
Nov 18th, 2008
I see. I wasn't aware of that.

However, the article suggested a solution that should solve the problem. This is, if I did understood it right. Update MDAC (latest version is 2.8) and use a client-side cursor. The article was updated 2005 for MDAC 2.5, so maybe just updating MDAC to 2.8 could solve the problem without the need to use client-side cursor. Is this possible to do or do you already have the latest MDAC?
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 5
Reputation: realnapstar is an unknown quantity at this point 
Solved Threads: 0
realnapstar realnapstar is offline Offline
Newbie Poster

Re: Run-Time Error '-2147217842(80040e4e)

 
0
  #5
Nov 18th, 2008
Thanks again for your replay
but actually i am using MDAC 2.8 in my system
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 710
Reputation: Teme64 will become famous soon enough Teme64 will become famous soon enough 
Solved Threads: 114
Teme64's Avatar
Teme64 Teme64 is offline Offline
Master Poster

Re: Run-Time Error '-2147217842(80040e4e)

 
0
  #6
Nov 19th, 2008
Then I'll refer to my first reply. At the point of error, what values does
oConn.Errors(0).NativeError
oConn.Errors(0).Description
have? oConn is your connection object. Also what type of CursorType property do you use?
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 5
Reputation: realnapstar is an unknown quantity at this point 
Solved Threads: 0
realnapstar realnapstar is offline Offline
Newbie Poster

Re: Run-Time Error '-2147217842(80040e4e)

 
0
  #7
Nov 19th, 2008
i use
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. adorset.CursorType = adOpenDynamic
  2. adorset.LockType = adLockOptimistic
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 710
Reputation: Teme64 will become famous soon enough Teme64 will become famous soon enough 
Solved Threads: 114
Teme64's Avatar
Teme64 Teme64 is offline Offline
Master Poster

Re: Run-Time Error '-2147217842(80040e4e)

 
0
  #8
Nov 19th, 2008
Ok. Here's a snippet from the code I'm using now:
  1. Set oConn = New ADODB.Connection
  2. ConStr = "PROVIDER=SQLOLEDB;Data Source=XXX; INITIAL CATALOG=XXXlab; User ID=XXX; Password=XXX;"
  3. oConn.Open ConStr
  4. ...
  5. Dim oRs As New ADODB.Recordset
  6.  
  7. oRs.CursorLocation = adUseClient
  8. strGridSQL = "SELECT * FROM [" & XXX & "]"
  9. oRs.Open strGridSQL, oConn, adOpenDynamic, adLockOptimistic
  10. oRs.Move 0 ' No error here or after
adding oRs.Move 0 has no effect, in the sense that no error occurs. My dev DB is SQL Server 2005 but I doubt that makes a difference (the code has been tested and targeted to 2000).

I'm still curious about oConn.Errors(0).NativeError and oConn.Errors(0).Description values?
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 5
Reputation: realnapstar is an unknown quantity at this point 
Solved Threads: 0
realnapstar realnapstar is offline Offline
Newbie Poster

Re: Run-Time Error '-2147217842(80040e4e)

 
0
  #9
Nov 19th, 2008
thank you my problem was solved. thanks for u r help, thanks a lot......

the error vanished when i use the CursorLocation as client . then no need for the move 0.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC