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. Database & SysAdmin
  3. Database
  4. Display Message while using Stored procedure

Display Message while using Stored procedure

Scheduled Pinned Locked Moved Database
database
7 Posts 5 Posters 0 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.
  • K Offline
    K Offline
    kankeyan
    wrote on last edited by
    #1

    In store procedure.i want to display a message.ie Alter procedure CheckForValidUser ( @Username varchar(20), @Password varchar(10) ) as select ltrim(rtrim(name_first + ' '+ isnull(name_last,''))) as name,rolename,p.pid, date_exit from hms_person p, HMS_personell pl where pl.username = @Username and password = @Password and pl.pid=p.pid ; I'm passing two parameters but to display three arguments,i want to get a message to display whether the date_exit is not null is it possible to display as popup regards Kankeyan

    D L 2 Replies Last reply
    0
    • K kankeyan

      In store procedure.i want to display a message.ie Alter procedure CheckForValidUser ( @Username varchar(20), @Password varchar(10) ) as select ltrim(rtrim(name_first + ' '+ isnull(name_last,''))) as name,rolename,p.pid, date_exit from hms_person p, HMS_personell pl where pl.username = @Username and password = @Password and pl.pid=p.pid ; I'm passing two parameters but to display three arguments,i want to get a message to display whether the date_exit is not null is it possible to display as popup regards Kankeyan

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      AFAIK no. 1. You must be doing all these checks in the business layer of your application. 2. In case something goes wrong in the stored procedure, send the message back to the calling method and it shaould take care of showing it to the user. (Not the exact message but a user freindly one)

      50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

      M 1 Reply Last reply
      0
      • D dan sh

        AFAIK no. 1. You must be doing all these checks in the business layer of your application. 2. In case something goes wrong in the stored procedure, send the message back to the calling method and it shaould take care of showing it to the user. (Not the exact message but a user freindly one)

        50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        Danish is correct, you need to trap the error and deal with it in the client. Remember SQL Server runs on the server, who is going to see a message box ON THE SERVER, you need to do all the work on the client

        Never underestimate the power of human stupidity RAH

        K 1 Reply Last reply
        0
        • K kankeyan

          In store procedure.i want to display a message.ie Alter procedure CheckForValidUser ( @Username varchar(20), @Password varchar(10) ) as select ltrim(rtrim(name_first + ' '+ isnull(name_last,''))) as name,rolename,p.pid, date_exit from hms_person p, HMS_personell pl where pl.username = @Username and password = @Password and pl.pid=p.pid ; I'm passing two parameters but to display three arguments,i want to get a message to display whether the date_exit is not null is it possible to display as popup regards Kankeyan

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          If this is required for debugging purpose, you can use the print statement, or if you want to notify your application users, you need to pass an appropriate value to the client and show the popup in the client application (such as a WinForms Form or an ASP.NET page).

          1 Reply Last reply
          0
          • M Mycroft Holmes

            Danish is correct, you need to trap the error and deal with it in the client. Remember SQL Server runs on the server, who is going to see a message box ON THE SERVER, you need to do all the work on the client

            Never underestimate the power of human stupidity RAH

            K Offline
            K Offline
            kankeyan
            wrote on last edited by
            #5

            is it possible to display in client side

            D A 2 Replies Last reply
            0
            • K kankeyan

              is it possible to display in client side

              D Offline
              D Offline
              dan sh
              wrote on last edited by
              #6

              I would again say, you should not let that null date to reach your DB. Check it beforehand. For other exception, you can have something like this: You can use try/catch in your stored procedure. Then, if it fails, you should send the exception back to your data access layer. That or business should inturn change the message to a user friendly one. Also, before doing this make sure you log it in somewhere for future reference. Once your message has reached UI layer, use MessageBox or Alert as applicable. In order to understand ho try catch works in SQL, use google and you will find a lot of help.

              50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

              1 Reply Last reply
              0
              • K kankeyan

                is it possible to display in client side

                A Offline
                A Offline
                Ashfield
                wrote on last edited by
                #7

                Only through your client application.

                Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

                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