Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 8th, 2007, 03:26 AM
Registered User
 
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default VB5.0 to VB .Net upgradation issue related to DAO

hi
I am facing a issue related to DAO.DBEngine. In previous VB5.0 application the database related errors are captured by DAO.DBEngine.Errors method.
The code like this,

Friend DAODBEngine_definst As New DAO.DBEngine
If DAODBEngine_definst.Errors(0).Number = 20023 Then
    MsgBox("Password matches with one of the prior passwords")
              Exit Sub
End If

after upgradation in VB .Net 2005 we are using Microsoft.Practices.EnterpriseLibrary
for datbase handling.
In new .Net applicaton error handling is done by using Try catch block
so can any one suggest me the replacement code of line "DAODBEngine_definst.Errors(0).Number = 20023 " .

This should be like
  catch ex as Exception
    If (ex. (some code)= 20023 )then
     MsgBox("Password matches with one of the prior passwords")
            Exit Sub
    End If
End try

ultimately how can i capture the error number in catch block.
 can i use Microsoft.VisualBasic.ErrObject to capture error number
Is it working same as DBengine.Error(0).number?
Thanks



 
Old October 10th, 2007, 03:15 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

The connection object should have an error collection that you can examine.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Related Issue asmii Beginning PHP 3 October 5th, 2008 07:07 PM
Date Related Issue Kirti.darji Visual Studio 2005 0 May 13th, 2008 06:40 AM
Zend Framework Related Issue Rajat Kumar Beginning PHP 0 May 6th, 2008 07:00 AM
VB.NET logic Issue. boycomputer Visual Studio 2005 1 September 20th, 2006 11:36 PM
VB.NET DAO DSN??? Blahcutey Access VBA 2 November 18th, 2004 07:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.