Note that there are some explanatory texts on larger screens.

plurals
  1. POMySqlDataReader.Read() throws ArgumentOutOfRangeException
    primarykey
    data
    text
    <p>I'm working with mysql .net connector 6.4.4 at win7 x64 platform. While reading data from MySqlDataReader Object, it throws exception after 18th row. But in another application I could take 40 rows without errors.</p> <p>The error is just here:</p> <p>MySqlDataReader.Read()</p> <p>Any helps would be very appreciated.</p> <pre><code>Exception details: System.ArgumentOutOfRangeException was unhandled Message=Non-negative number required. Parameter name: count Source=mscorlib ParamName=count StackTrace: at System.IO.MemoryStream.Read(Byte[] buffer, Int32 offset, Int32 count) at MySql.Data.MySqlClient.MySqlPacket.Read(Byte[] byteBuffer, Int32 offset, Int32 count) at MySql.Data.MySqlClient.MySqlPacket.ReadString(Int64 length) at MySql.Data.Types.MySqlString.MySql.Data.Types.IMySqlValue.ReadValue(MySqlPacket packet, Int64 length, Boolean nullVal) at MySql.Data.MySqlClient.NativeDriver.ReadColumnValue(Int32 index, MySqlField field, IMySqlValue valObject) at MySql.Data.MySqlClient.Driver.ReadColumnValue(Int32 index, MySqlField field, IMySqlValue value) at MySql.Data.MySqlClient.ResultSet.ReadColumnData(Boolean outputParms) at MySql.Data.MySqlClient.ResultSet.NextRow(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlDataReader.Read() at VeriTasima.Form1..ctor() in E:\Projeler\VeriTasima\VeriTasima\Form1.cs:line 42 at VeriTasima.Program.Main() in E:\Projeler\VeriTasima\VeriTasima\Program.cs:line 18 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: </code></pre> <p>Updated:</p> <pre><code>// test string commandString = "SELECT * FROM haber LIMIT 50"; MySqlConnection connection = new MySqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["MySQL"].ConnectionString); MySqlCommand command = new MySqlCommand(commandString, connection); connection.Open(); MySqlDataReader sdr = command.ExecuteReader(); int count = 0; while (sdr.Read()) { count++; } sdr.Close(); sdr.Dispose(); command.Dispose(); connection.Close(); connection.Dispose(); MessageBox.Show(count.ToString()); </code></pre> <p>Updated:</p> <p>I fixed this problem by setting target platfrom from x86 to Any CPU. Now works properly.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload