Server Error in '/' Application.

Non-negative number required.
Parameter name: count

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: Non-negative number required.
Parameter name: count

Source Error:


Line 401:                for (int k = 0; k < j; k++)
Line 402:                {
Line 403:                    dt.Rows[i][k] = dr[k].ToString();
Line 404:                }
Line 405:                i++;

Source File: c:\Inetpub\vhosts\korfezhalimobilya.com.tr\httpdocs\App_Code\MyCode.cs    Line: 403

Stack Trace:


[ArgumentOutOfRangeException: Non-negative number required.
Parameter name: count]
   System.Buffer.BlockCopy(Array src, Int32 srcOffset, Array dst, Int32 dstOffset, Int32 count) +0
   System.Data.SqlClient.TdsParserStateObject.TryReadByteArray(Byte[] buff, Int32 offset, Int32 len, Int32& totalRead) +154
   System.Data.SqlClient.TdsParserStateObject.TryReadInt32(Int32& value) +63
   System.Data.SqlClient.TdsParser.TryReadSqlValueInternal(SqlBuffer value, Byte tdsType, Int32 length, TdsParserStateObject stateObj) +367
   System.Data.SqlClient.TdsParser.TryReadSqlValue(SqlBuffer value, SqlMetaDataPriv md, Int32 length, TdsParserStateObject stateObj, SqlCommandColumnEncryptionSetting columnEncryptionOverride, String columnName) +652
   System.Data.SqlClient.SqlDataReader.TryReadColumnInternal(Int32 i, Boolean readHeaderOnly) +674
   System.Data.SqlClient.SqlDataReader.TryReadColumn(Int32 i, Boolean setTimeout, Boolean allowPartiallyReadColumn) +96
   System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i) +32
   System.Data.SqlClient.SqlDataReader.GetValue(Int32 i) +76
   System.Data.SqlClient.SqlDataReader.get_Item(Int32 i) +12
   DataBase.doldur_DT(DataTable dt, String sql) in c:\Inetpub\vhosts\korfezhalimobilya.com.tr\httpdocs\App_Code\MyCode.cs:403
   MarkaUrun.Page_Load(Object sender, EventArgs e) in c:\Inetpub\vhosts\korfezhalimobilya.com.tr\httpdocs\MarkaUrun.aspx.cs:59
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
   System.Web.UI.Control.OnLoad(EventArgs e) +97
   System.Web.UI.Control.LoadRecursive() +61
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +693


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