Results 1 to 2 of 2

Thread: Err Raise in SQL to VB

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    16

    Question

    hello

    I am trying to do an erroraise from sql server in a stored procedureto vb and then
    show it to the user, but I cant get it together.
    anybody with an idea.

    thanks Micke

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    Hi

    Stored Procedure:
    Code:
    CREATE PROCEDURE spu_test 
    
    AS
    
    RaisError ('THERE WAS AN ERROR', 15, 1)
    VB:
    Code:
    Private Sub Form_Load()
        
        On Error GoTo Err_Handler
        
        Dim cn As New Connection
        
        cn.Open <ConnectionString>
        
        cn.Execute "spu_test"
        
        Exit Sub
        
    Err_Handler:
        MsgBox Err.Description
        
    End Sub
    This will raise an error from the SQL Stored Proc and pass it back to the client for handling

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width