PDA

Click to See Complete Forum and Search --> : Execution Error -2147217887 ?????


Patrice Bourdages
Jun 28th, 2000, 01:37 AM
I've got some kind of problem. I'm using a VB6 SP3 apps on a SQL Server v7.0 database.

Considering the following Sub:

Private Sub PetitRobert()
Dim strCherche As String
TableSigma.MoveFirst
TableSigma.Find "NomTable = '" & mNomDeTable & "'", , adSearchForward
If Not TableSigma.EOF Then
Dictionnaire.MoveFirst
strCherche = Mid(mNomDuChamp, 1, 5)
Dictionnaire.Find "NomChamp = '" & strCherche & "'", , adSearchForward
If Dictionnaire.EOF Then
Dictionnaire.AddNew
Dictionnaire!NomChamp = strCherche
Dictionnaire!Description = mDescription
Dictionnaire!TypeChamp = mTypeChamp
Dictionnaire!Longueur = mLongueur
Dictionnaire!Decimale = mDecimale
Dictionnaire!EstUneDate = ""
Dictionnaire!NouveauNom = ""
Dictionnaire!NouvelleDescription = ""
Dictionnaire.Update
End If
End If
End Sub

I've got the following error at runtime:

Execution Error '-2147217887 (80040e21)'
Multiple-step operation generated errors.
Check each status value.

The programs stops at the following line:
Dictionnaire!NomChamp = strCherche

What's wrong with my program??? If I try to manually add the data into SQL Server 7.0, no problem whatsoever...

Thanks in advance for any advice or help.

Sincerely, Patrice :-)

Clunietp
Jun 28th, 2000, 12:08 PM
loop thru the Connection.Errors collection to get a specific description of the error

Patrice Bourdages
Jun 28th, 2000, 07:18 PM
Sure... ;-(

How do I do that...?

on error goto PetitRobertError

...

PetitRobertError:
msgbox ??????

I'm not sure how to do that

Could you help me out.

Thanks :-)

Clunietp
Jun 28th, 2000, 11:21 PM
On Error GoTo Err_Handler

Dim cn As ADODB.Connection
Dim objError As ADODB.Error

Set cn = New Connection

cn.Open "Provider=SQLOLEDB;Data Source=WrongServerNameToGenerateError;UID=User;PWD=Password;Connect Timeout=2"

'do other stuff here


cn.Close
Set cn = Nothing

Exit Sub

Err_Handler:
'loop thru errors collection
For Each objError In cn.Errors
MsgBox objError.Description
Next objError

Patrice Bourdages
Jun 28th, 2000, 11:43 PM
Thank you very much...

This kind of help is very appreciated.

Sincerely yours,

Patrice :-)