Catch and return web service SQL error.

Results 1 to 2 of 2

Thread: Catch and return web service SQL error.

  1. #1
    Join Date
    Dec 1969

    Default Catch and return web service SQL error.

    I am using web services to for all SQL Server database access.<BR>I can use the Try-Catch block to catch SQL errors. But the services return a datagrid. How can I return an error message in the datagrid, so the calling code can know there was a SQL error or any other error in the web service?<BR><BR> Try<BR> resulto = cmd.ExecuteScalar()<BR> &#039;Catch sqlErr As SqlException<BR> Catch ex As OPALibItx.OPAException<BR> logger.WriteLog<BR> Catch ex As Exception<BR> logger.WriteLog<BR> End Try<BR><BR>return datagrid

  2. #2
    Join Date
    Dec 1969

    Default Return Nothing

    And then test for NOTHING in the caller.<BR><BR>I don&#039;t see any other practical way, if you are really returning the datagrid. Not quite sure why you do that, instead of returning something a little lower down, but I can&#039;t see why it can&#039;t work.<BR><BR>

Posting Permissions

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