Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to catch the and publish yourself the message?

How to catch the and publish yourself the message?

Scheduled Pinned Locked Moved Visual Basic
databasehelpquestionsql-server
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I am writing an application in VB6 to interface with SQL 6.5 and have a question regarding catching login failure messages. The first thing my application does is prompt the user for his SQL userid and password. I then try to login to SQL Server. If the user entered a wrong password, the Microsoft SQL Server Login failed message is displayed.This message contains too much technical information that will confuse the users. I would like to trap the error and send my own screen with more user friendly information. The exact error message is 'Connection Failed: SQL State: '28000' SQL Server Error 4002. Public Connection As String Public DBTemp As Database Connection = "odbc;logintimeout=30;DSN=Station Train Control;" Set DBTemp = OpenDatabase("", True, False, Connection) Please help! Lillian.

    R 1 Reply Last reply
    0
    • L Lost User

      I am writing an application in VB6 to interface with SQL 6.5 and have a question regarding catching login failure messages. The first thing my application does is prompt the user for his SQL userid and password. I then try to login to SQL Server. If the user entered a wrong password, the Microsoft SQL Server Login failed message is displayed.This message contains too much technical information that will confuse the users. I would like to trap the error and send my own screen with more user friendly information. The exact error message is 'Connection Failed: SQL State: '28000' SQL Server Error 4002. Public Connection As String Public DBTemp As Database Connection = "odbc;logintimeout=30;DSN=Station Train Control;" Set DBTemp = OpenDatabase("", True, False, Connection) Please help! Lillian.

      R Offline
      R Offline
      Rayman
      wrote on last edited by
      #2

      Why don't you place the code in a Boolean function, then trap it like followed: private function connect_to_db(Connection as string) as boolean on error goto failed_open set DBTemp = OpenDataBase("",true,false,Connection )'Public connect_to_db = true exit function failed_open: if err.number = 28000 then msgbox "Wrong Password Or User name, please try again" connect_to_db=false exit function end function Hoped to have helped you : :-O Rayman

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups