Home All Groups Group Topic Archive Search About

.Net SqlException, RAISERROR and Remote machines.

Author
27 Jul 2006 11:26 AM
mehdi
Hi,
Consider a client machine running a .NET application. The app is
configured to access a remote SQL Server 2005, though a connection
string. Now consider an SQL Insert statement that fails (for whatever
reason). This produces (normally) an SqlException if both client and
server machines are the same. (i.e, if the client is running on the
same machine that hosts SQL Server).

The question is that what happens if they are not running on the same
machine? Does any error happening in SQL Server (the remote machine) as
well as RAISERROR keyword, generate the same SqlException (on the
client side)? If yes, would you please let me know how this can be
serialized from the remote machine to the local one?

TIA,
Mehdi

Author
27 Jul 2006 11:45 AM
Dan Guzman
> Does any error happening in SQL Server (the remote machine) as
> well as RAISERROR keyword, generate the same SqlException (on the
> client side)? If yes, would you please let me know how this can be
> serialized from the remote machine to the local one?

A SqlException is always raised on the client when an error occurs even when
the client is running on a different machine.  You don't need to do anything
special to serialize the exception because the database access API (e.g.
SqlClient, OleDb) takes care of all the implementation details.

Perhaps you are getting database access confused with .Net remoting.

--
Hope this helps.

Dan Guzman
SQL Server MVP

Show quote
"mehdi" <mehdi.mous***@gmail.com> wrote in message
news:1153999591.560940.201070@p79g2000cwp.googlegroups.com...
> Hi,
> Consider a client machine running a .NET application. The app is
> configured to access a remote SQL Server 2005, though a connection
> string. Now consider an SQL Insert statement that fails (for whatever
> reason). This produces (normally) an SqlException if both client and
> server machines are the same. (i.e, if the client is running on the
> same machine that hosts SQL Server).
>
> The question is that what happens if they are not running on the same
> machine? Does any error happening in SQL Server (the remote machine) as
> well as RAISERROR keyword, generate the same SqlException (on the
> client side)? If yes, would you please let me know how this can be
> serialized from the remote machine to the local one?
>
> TIA,
> Mehdi
>

AddThis Social Bookmark Button