Server Error in '/' Application.

Length cannot be less than zero.
Parameter name: length

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length

Source Error:


Line 64:             cs = cs + ds11.Tables[0].Rows[k][0].ToString() + ",";
Line 65:         }
Line 66:         string st = "Select code,enquirytype from enquirytype a where code in("+cs.Substring(0,cs.Length-1)+") group by code,enquirytype";
Line 67:         SqlDataAdapter adp = new SqlDataAdapter(st, ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
Line 68:         DataSet ds = new DataSet();

Source File: d:\inetpub\vhosts\crmnonstophimalayas.in\clickforholiday.com\Agent\Detail3.aspx.cs    Line: 66

Stack Trace:


[ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length]
   System.String.Substring(Int32 startIndex, Int32 length) +14670769
   Detail.bind_tourtype() in d:\inetpub\vhosts\crmnonstophimalayas.in\clickforholiday.com\Agent\Detail3.aspx.cs:66
   Detail.Page_Load(Object sender, EventArgs e) in d:\inetpub\vhosts\crmnonstophimalayas.in\clickforholiday.com\Agent\Detail3.aspx.cs:34
   System.Web.UI.Control.OnLoad(EventArgs e) +108
   System.Web.UI.Control.LoadRecursive() +90
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1602


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.9224.0