Problem to exception RRS feed

  • Question

  • User364663285 posted


    I have got

       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResul

    with these codes

                List<HouseData> houseList = new List<HouseData>();
                    using (SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["Mssqlconn3"].ConnectionString))
                        using (SqlCommand sqlCmd = new SqlCommand("SELECT cast(ROW_NUMBER() OVER (ORDER BY house_id ASC) as int) serial_id, house_id, rent_type, house_name, area, area_unit2, clicked_times, area_unit, area_size, isnull(construct_area_size,0) construct_area_size, isnull(request_times,0) request_times, release_period_from, CONVERT(varchar,register_date,105) register_date,CONVERT(varchar,upd_date,105) upd_date, address1, address2, price, price_curr, ltrim(rtrim(cast(raised_by_user_id as varchar))) raised_by_user_id FROM house_tab where isnull(raised_by_user_id,0)=@raiser and isnull(deleted,'')<>'Y'", sqlConn))
                            sqlCmd.CommandType = CommandType.Text;
                            sqlCmd.Parameters.AddWithValue("@raiser", System.Web.HttpContext.Current.Session["user_id"]);
                            SqlDataAdapter sqlAd = new SqlDataAdapter(sqlCmd);
                            DataTable sqlDt = new DataTable();
                            if (null != sqlDt)
                                houseList = sqlDt
                                                .Select(dataRow => new HouseData
                                                    serial_id = dataRow.Field<int>("serial_id"),
                                                    house_id = dataRow.Field<int>("house_id"),
                                                    house_name = dataRow.Field<string>("house_name"),
                                                    address1 = dataRow.Field<string>("address1"),
                                                    address2 = dataRow.Field<string>("address2"),
                                                    area = dataRow.Field<string>("area"),
                                                    area_unit = dataRow.Field<string>("area_unit"),
                                                    rent_type = dataRow.Field<string>("rent_type"),
                                                    register_date = dataRow.Field<string>("register_date"),
                                                    upd_date = dataRow.Field<string>("upd_date"),
                                                    area_unit2 = dataRow.Field<string>("area_unit2"),
                                                    clicked_times = dataRow.Field<decimal>("clicked_times"),
                                                    construct_area_size = dataRow.Field<decimal>("construct_area_size"),
                                                    request_times = dataRow.Field<decimal>("request_times"),
                                                    area_size = dataRow.Field<decimal>("area_size"),
                                                    price = dataRow.Field<decimal>("price"),
                                                    price_curr = dataRow.Field<string>("price_curr"),
                                                    raised_by_user_id = dataRow.Field<string>("raised_by_user_id"),


    Tuesday, November 6, 2018 5:02 AM

All replies

  • User839733648 posted

    Hi wmec,

    It seems that the error message tells you that some of the values obtained are too long to be stored in the specified column.

    I’m not sure about your database design about the sizes of your columns.

    Maybe there's a limited size there and I suggest that you could check it.

    For more about the solution of the error message, you could refer to the thread in this link: 


    Best Regards,


    Wednesday, November 7, 2018 9:07 AM
  • User1120430333 posted

    <msreadoutspan class="msreadout-line-highlight">You have posted nothing about the exception. There has to be an exception message that you are not posting that tells what </msreadoutspan><msreadoutspan class="msreadout-line-highlight">the</msreadoutspan><msreadoutspan class="msreadout-line-highlight"> <msreadoutspan class="msreadout-word-highlight">exception</msreadoutspan> is about.</msreadoutspan>

    Wednesday, November 7, 2018 1:25 PM
  • User753101303 posted


    I believe we have gone through that previously. The problem is that you are showing Exception.StackTrace rather than Exception.ToString(). As a result when an exception happens you know just WHERE it happens while Exception.ToString() would show both WHAT happens (including inner exceptions) as well as the stack trace.

    Any chance you could know change this. It should really change your life ;-) - at least regarding debugging.

    Wednesday, November 7, 2018 2:19 PM