Questions tagged [mysqldatareader]

Reads a forward-only stream of rows from a MySQL database.

Reads a forward-only stream of rows from a MySQL database. To create a MySqlDataReader, you must call the ExecuteReader method of the MySqlCommand object, rather than directly using a constructor.

107 questions
2
votes
3 answers

C# DataReader error

I looked for a solution to this problem on the forum, but I didn't find one for my problem. On button click, I receive error: There is already an open DataReader associated with this Connection which must be closed first. So, I tried to close all…
dpaul1994
  • 332
  • 3
  • 16
1
vote
2 answers

Why my MysqlDataReader object becoming null?

I have the following class: using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; using MySql.Data.MySqlClient; namespace DataBaseModule.General { public class ManagedDataReader :…
Eitan H.S.
  • 430
  • 3
  • 15
1
vote
2 answers

MySqlDataReader.Read() "Timeout" when read from a very big table (over 100 million records)

I have a big table which contains about 100 million records in MySQL. I want to read all the records from it and process them in my C#/.Net program, so I wrote some code like this: string sql = "SELECT * FROM the_table"; MySqlCommand cmd = new…
Hancy
  • 513
  • 2
  • 5
  • 9
1
vote
0 answers

MySql.Data.MySqlClient.MySqlException: 'GetBytes can only be called on binary or guid columns'

I'm developing an app in C# with .NET and MySQL database. I need to be able to insert and retrieve images in and out of the database and I have a column named 'Image' of type LONGBLOB for that purpose. The insertion goes well but when I try to…
1
vote
1 answer

Can I reset and loop again through MySqlDataReader?

I have a MySqlDataReader object, with the result of this query : SELECT warehouse, leasing, transportation, maintenance, manpower FROM retail WHERE zone = 'Central' GROUP BY warehouse And then I loop through the DataReader once, while…
Hrishikesh Choudhari
  • 11,617
  • 18
  • 61
  • 74
1
vote
2 answers

How to execute another MySqlDataReader for each read ID?

I'm trying to get from my database some data, each of that data may have some attributes, so my logic was while i'm getting all data so while the MySqlDataReader is executed i was going to execute the query for each id of data i got to get it's…
NiceToMytyuk
  • 3,644
  • 3
  • 39
  • 100
1
vote
1 answer

SqlDataReader.HasRows return always "true" even with empty result

After browsing a multitude topics on the phenomenon of SqlDataReader.HasRows which always returns true even with empty result (and especially when it is about an SQL query with an aggregate), I dry completely on my code However my example is very…
aurepito
  • 101
  • 11
1
vote
0 answers

Slow Performance to Fetch Million Rows from MySQL Database and write to csv

EDIT: Iterating over Reader takes time, Execute Reader returns in few seconds. Is there some faster way instead of iterating ? I am trying to fetch data from MySQL based on Filters. Previously i was using EF it was very slow, so then i decided to…
Faizan khan
  • 185
  • 1
  • 12
1
vote
1 answer

MySQLDataReader not reading C#

The Stored Procedure: BEGIN SELECT * FROM `user` WHERE `EmailAddress`= @p0 AND `Password` = @p1; END Where @p0 and @p1 are Varchar(100). And the code: using (MySqlConnection con = new MySqlConnection(Database.MySQLConstring)) { using…
MisterMan
  • 23
  • 7
1
vote
2 answers

Powershell Export-CSV from MySQL database reader fails mid-export

I'm a bit new to PowerShell, and I've got a new requirement to get Data out of a MySQL database and into an Oracle one. The strategy I chose was to output to a CSV and then import the CSV into Oracle. I wanted to get a progress bar for the export…
Thomas
  • 339
  • 4
  • 15
1
vote
3 answers

Avoid NullReferenceException

I'm fairly new to .NET programming. I am trying to check if there are settings in a database table and if not, create some default settings. The problem is that when there are no settings I need to make two calls with the datareader and it keeps…
Geoff
  • 256
  • 2
  • 5
  • 20
1
vote
3 answers

Unable to Get value from MySQL and print to TextBox

So this method is supposed to get the ipaddress of the logged in user from a MySQL Database and print it to a textbox. However, I cant seem to get it right as the program just closes after I execute this method. public void readIPAddress() …
Marvinatorrr
  • 103
  • 1
  • 3
  • 15
1
vote
2 answers

Converting MySqlDataReader records to ObservableCollection

I am trying to convert records from MySqlDataReader to ObservableCollection but I always end up with exception - Unable to cast object of type 'System.Data.Common.DataRecordInternal' to type 'System.Data.IDataReader' From Jon Skeet's answer over…
Guruprasad J Rao
  • 29,410
  • 14
  • 101
  • 200
1
vote
3 answers

How to manage the mysql connection in correct way without getting a error

I am new to the C# and My method showing a error in try catch connection is already open code as follow, when I closed it from Class method then Form getting a error invalid connection. here if put all code in FORM it is working. but here I get…
KBK
  • 375
  • 1
  • 4
  • 20
1
vote
1 answer

MySqlDataReader doesnt read my query as if there was no rows returned but PHPMyAdmin return rows with the same query

first time requesting your help here. I know my title is wrong, i will change it if once we figure what is the issue, at the moment im kinda lost. Alright there we go first i wanna select all users from my database that are in range of the current…
Sylvain Martens
  • 1,306
  • 1
  • 9
  • 14