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.

101 questions
0
votes
1 answer

Populate multiple objects from JSON

I have this code: public class Customer { Int32 id { get; set; } = 0; User user1 { get; set; } = null; User user2 { get; set; } = null; } /* ... */ using (MySqlConnection conn = new MySqlConnection(Costanti.connessione)) { …
Pasto92
  • 21
  • 1
0
votes
2 answers

ASP.NET - GridView empty after page reload

I'm using a MySQL database to store some data, I've got a page in my ASP-project which should show the whole table, when you open up the page as a standard result. Well actually it does, but just one time, if you reload the page or direct to another…
0
votes
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
  • 155
  • 1
  • 11
0
votes
1 answer

How to show only the items in specific country in listview?

I have a listView that show the user all item that saved in mySql database .. and for User table the user have his Country name .. my question is how I can show the user only item in his Country because I don't want to show him all the item in…
0
votes
1 answer

c# Input string was in incorrect format error when data reading

so this is my problem. this function: public int Reader(string query, string value, int id, int reader) { CloseConnection(); int i = 0; con.Open(); MySqlCommand cmd; cmd = new MySqlCommand(query,…
user9806487
0
votes
1 answer

Else statement fails to work within a while loop

Below is my code to connect to the database using MySqlDataReader. Now the if statement is working fine but the else statement doesnt. When i use the debug function in VS it kept skipping the else statement and jump to the reader.Close();. Any idea.…
epiphany
  • 730
  • 9
  • 25
0
votes
0 answers

Difference between Convert.ToBoolean(reader["Name"]) and (bool) (reader["Name"])?

While working on a .Net project and SqlDataReader, came to question about difference between: Convert.ToBoolean(reader["Name"]) And: (bool) (reader["Name"])
Sami
  • 3,096
  • 3
  • 13
  • 24
0
votes
0 answers

Binding ADO DataReader to GridView

Trying to bind the data that I recover from ADO query, I am getting the same error after trying different approach (usaing dataTable, DataView,...). The last one I used is the next: string query = "SELECT * FROM productos"; MySqlConnection con = new…
Elias MP
  • 1,829
  • 9
  • 29
  • 47
0
votes
1 answer

Invalid attempt to read when Reader is closed - MySqlDataReader C#

Getting an Invalid attempt to read when Reader is closed exception in my duplicateNameCheck method, when attempting to read from the DataReader. I'm not sure why. Any help is greatly appreciated! public static MySqlConnection GetSqlConnection() { …
kevin
  • 5
  • 3
0
votes
0 answers

Mysqldatareader not returns records at all

I have the function in my class, which gets querystring and returns the two dimensional object array: Public Function GetResultsBySql(ByVal sql As String) As Object(,) Dim b(,) As Object = Nothing Dim Command As New…
GGSoft
  • 389
  • 4
  • 12
0
votes
2 answers

MySqlDataReader doesn't close after calling Close() on the reader

I am not quite sure if I am experiencing a bug or I don't get how it supposed to work. So recently I've been trying to resolve this exception MySql.Data.MySqlClient.MySqlException: 'There is already an open DataReader associated with this Connection…
bazzilic
  • 671
  • 1
  • 6
  • 17
0
votes
1 answer

MySqlDataReader - Invalid Attempt to Read When Reader is Closed

I appreciate this question will have been asked before, however, I have spent the last 5 days trawling SO and the web and haven't yet found a solution to my problem. I am trying to use C# to retrieve a record from a MySQL Database. The code compiles…
0
votes
1 answer

VB.Net) using condition data reader on join tables

I'm trying to collect data from joining table and currently there is a null displaying (no error found). I think my code isn't efficient tough. But here it is what I'm trying: conn.Open() sqlcmd = New MySqlCommand("select tabsen.id_absen,…
Ryan
  • 3
  • 3
0
votes
1 answer

C# store contents from DB into list

C# Code: try { string mydbConnection = "datasource=localhost;port=3306;username=root;password=Greenford123;"; MySqlConnection connDB = new MySqlConnection(mydbConnection); MySqlCommand cmdDataBase = new…
0
votes
1 answer

Error when trying to Insert, Update or Delete: There is already an open DataReader associated with this Command which must be closed first

Imports MySql.Data.MySqlClient Public Class manageAdminAccounts Dim MysqlConn As MySqlConnection Dim COMMAND As MySqlCommand Dim dbDataSet As New DataTable Dim SDA As New MySqlDataAdapter Private Sub btnBack_Click(sender As…