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
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
  • 439
  • 6
  • 15
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
  • 826
  • 2
  • 8
  • 22
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,…
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…
0
votes
2 answers

C# get exact string from Mysql not working

I have problems with a MySQL data using C#. The string data in the database is a multiline text, I mean, with the " \n ". So I want to show it in a multiline texbox but it shows me everything in one line. For example: the string in the database is:…
suffuko
  • 143
  • 1
  • 2
  • 12
0
votes
3 answers

reader.GetDouble needs int?

I'm currently getting the total lates of an employee within a certain period in the format of totalhours and double from a database but the problem is when I check the database and lets say that the employee doesn't have a single record of late…
Enriko
  • 77
  • 7
0
votes
1 answer

Optimization of SQL Select for enumerators

How can this query be optimized for enumerators: SELECT * FROM Customers Table Customers customerId int - has index on it customerName, etc SqlReader that returns a set customers will be read on-demand in an enumerator fashion. While it can return…
kateroh
  • 4,382
  • 6
  • 43
  • 62
0
votes
2 answers

Reader doesn't return all rows from database

So i have a web api that presents values from my database. However i have 6 rows in my database, but it doesn't return the first row. How do i get it to read and return all rows in my database? cmd.CommandText = "SELECT * FROM…
Jeppe Christensen
  • 1,680
  • 2
  • 21
  • 50
0
votes
2 answers

how two get data from 2 different table c#

I have two table.I need to get calorificValue from the food table and daily_gained from the calorie_tracker table to then make some calculations.I've written this code, I know it not efficent. It retrieves daily_gained but failed to get…
ekn
  • 47
  • 10
0
votes
0 answers

Best way to deal with Open Datareader Error (vb.net and mysql)

My Project running on VS 2013 & MySQL, I have declared public variable conn as mysqlconnection and I use the same connection all over the project to perform any database operation. Public conn As New MySqlConnection Public Sub…
Iqlas Uddin
  • 177
  • 2
  • 15
0
votes
0 answers

C# MySqlDataReader in MySqlDataReader

In php I have something like that: $zapytanie1 = "SELECT * FROM tabelka2"; $wykonaj1 = mysql_query($zapytanie1); while($dane1 = mysql_fetch_array($wykonaj1)) { $idzs = $dane1['id']; $zapytanie2 = "SELECT * FROM tabelka2 WHERE dane=$idzs"; $wykonaj =…
harbii
  • 135
  • 2
  • 10
0
votes
1 answer

MySqlDataReader example with 2 sets of brackets

on the internet i saw an MySqlDataReader example. It was saying something like: read("products")("amount") I know you can get data from field "product" from the reader by read("product") but I didn't understand the second () set. Nowhere info to be…
0
votes
1 answer

CSVHelper not formatting CSV

I'm using CSVHelper to write a List<> that I've obtained by using MySqlDataReader. My problem is with formatting my CSV file correctly, I've created a mapper class that should dictate where to place the data by column name: public ReaderMap() …