PDA

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


Oct 21st, 1999, 07:44 PM
I am using SQLServer 6.5 as a Backend and VB 6 prof. And I am using ADO 2.1 with SQLOLEDB provider. Whenever I try to make any chages to the database and if it violates any constraint I get geneal error. " -2147217887 Errors occurred" . If I want specific error info like Primary key violation or Check constraint violation or specific error info from a trigger. How do I do that. With this general error I don't have a clue. I have used Connection objects error collection but that don't give me specific error information.

Thanks in Advance,
Anagha

Serge
Oct 21st, 1999, 08:47 PM
You can use Errors collection to get all errors:


Dim cn As New ADODB.Connection
Dim i As Integer

On Error Resume Next

cn.ConnectionString = "DSN=MyDSN;UID=sa;PWD=;"
cn.Open

cn.Execute "Update MyTable Set MyField = MyValue"
For i = 0 To cn.Errors.Count - 1
Debug.Print cn.Errors(i).Description
Next


Regards,

------------------

Serge

Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com




[This message has been edited by Serge (edited 10-22-1999).]