|
-
Oct 21st, 1999, 07:44 PM
#1
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
-
Oct 21st, 1999, 08:47 PM
#2
You can use Errors collection to get all errors:
Code:
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
[email protected]
[email protected]
[This message has been edited by Serge (edited 10-22-1999).]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|