Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 521793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:17:13+00:00 2026-05-13T08:17:13+00:00

I have a .aspx page calling a .asmx page’s web service. In that .net

  • 0

I have a .aspx page calling a .asmx page’s web service. In that .net web service I attempt to open a database connection to SQLServer 2008. The connection is failing. I am not sure why. I am doing this in a try / catch and the catch does get hit when I debug. I’m not sure what I can output there though as I don’t have access to the server’s filesystem to write a log file.

I found this posting:

try
{
   SqlCommand cmd =
       new SqlCommand("raiserror('Manual SQL exception', 16, 1)",DBConn);
   cmd.ExecuteNonQuery();
}
catch (SqlException ex)
{
   string msg = ex.Message; // msg = "Manual SQL exception"
}

here and it might do the trick for me, but I don’t know how to make the msg string output to the page which called this web service? Is there a way to propagate it up the exception chain by having the calling page also implement that same exception handler?

Thanks // 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:17:13+00:00Added an answer on May 13, 2026 at 8:17 am

    Your should be able to trap the SQL Exception as a specifc type and read the particular error message:

    try{
       ...
    }
    catch(SQLException sqlex)
    {
       /// do some work here with sqlex.Message
    }
    catch(Exception ex)
    {
       /// this will trap any other 'type' of exception incase a sqlex is not thrown.
    }
    

    You could then throw this “up the stack” which means sending it back to the method which called the failing code:

    catch(SQLException sqlex)
        {
           throw sqlex;
        }
    

    Or you could throw a new message based on the sql exception:

    catch (SQLException sqlex)
      {
        throw new Exception("My method threw an exception in SQL:" + sqlex.Message);
      }
    

    All of these approaches allow you to send messages back up the stack to the client that called the SQL. This is where you should render you message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASPX page and on this page I have a control that
I have Default.aspx page, which inherits from BasePage.cs, which inherits from System.Web.UI.Page. BasePage is
I have an ASPX page (On server A) which is invoked using NTLM credentials.
I have one aspx page with some controls. Also i have one DIV which
I have an aspx page,where the user will enter a valid image url(ex :
I have an ASPX page where I am uploading an image to server for
I have an aspx page where i am Processing a large number of records
I have an aspx page with 5 listboxes. Each listbox can filter the other
I have an aspx page with 1 table containing 2 rows: <!DOCTYPE html PUBLIC
I have an aspx page with a gridview. In my page load event, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.