try
{
 //数据库连接语句
}
catch(Exception e)  

  string ErrorMsg="<script language=\"javascript\">alert('"+e.Message+"')<"+"/script>";
  Response.Write(ErrorMsg);
}

解决方案 »

  1.   

    catch(Exception e)
    {
    response.write(e.toString())
    }
      

  2.   

    catch(Exception e)
    {
      return -100;  // 用-100来表示发生异常。   
    }
      

  3.   

    Try ''''''判断出错信息
               
            Catch ex As DBConcurrencyException
                Dim customErrorMessage As String
                customErrorMessage = ex.Message & vbCrLf
                customErrorMessage += CType(ex.Row.Item(0), String)
                Response.Write(customErrorMessage)
            End Try
      

  4.   

    catch(Exception e)
    {
    response.write(e.toString())
    }
      

  5.   

    to cad100
    不要拷贝我的代码。