Hi,
Can anyone please help me - I still cant get the exception on my client.
Thanks
Msuk
[quoted text, click to view] "msuk" wrote:
> All,
>
> I have a remote server that my client calls running on two separate PC's.
> On my remote sever I have a method that returns a ADO.Net Dataset that has a
> try and catch block around it. Now if for example I cause an exception by
> using an incorrect connection string I would like to throw the error back to
> my client - how can I do this?
>
> Currently I am doing the following:
>
> private void getDataSet(string storedProcName, string tableName,DataSet
> himData)
> {
> SqlConnection myConnection = new
> SqlConnection(Configuration.ConnectionInfo);
> // Create a SqlDataAdapter.
> SqlDataAdapter myAdapter = new SqlDataAdapter();
>
> try
> {
> myConnection.Open();
> SqlCommand myCommand = new SqlCommand(storedProcName,myConnection);
> myCommand.CommandType = CommandType.StoredProcedure;
> myAdapter.SelectCommand = myCommand;
> myAdapter.Fill(xxxx,tableName);
> myConnection.Close();
> }
> catch (Exception ex)
> {
>
> throw ex;
> }
> finally
> {
> this.closeDBConnection(myConnection);
> }
>
> }
>
> At the client end I am getting the following message for the exception:
>
> “Server encountered an internal error. For more information, turn on
> customErrors in the server’s .config file.†Using this information I looked
> up the customErrors element in the online help and put together the following
> .config file.
>
> I am using a config file and have the following element:
>
> <system.runtime.remoting>
> <customErrors mode="off"/>
> .............................
>
> Thanks