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
1
vote
1 answer

DataReader: What is the "real" property of r("somecolumn")?

I am using a MySqlDataReader and a Sqlite.SqliteDatareader. For both, I can access the value of a column like this: Do While r.Read dim sSomeString = r("SomeColumn") (...) I think that r("SomeColumn") internally resolves to a…
tmighty
  • 8,222
  • 19
  • 78
  • 182
1
vote
2 answers

IsDBNul with string

I try to use currentOrder.PONumber = (reader.IsDBNull("PONumber") ? "Geen klantreferentie" : reader.GetString("PONumber")); and I have the following errors: The best overloaded method match for 'System.Data.Common.DbDataReader.IsDBNull(int)'…
Marten
  • 1,331
  • 5
  • 27
  • 44
1
vote
9 answers

Checking the number of rows returned from MySQL Data Reader

I am currently working on an C# project and I am trying to get the number of rows returned from MySQL Data Reader. I know there is no direct function so I am trying to write my own. In the function, I pass it the MySQLDataReader object and then…
Boardy
  • 31,944
  • 94
  • 238
  • 411
1
vote
2 answers

Index was outside the bounds of the array, but i can't see the error

int n =Count("SELECT COUNT(*) FROM information_schema.SCHEMATA");; //return 6 TreeNode[] db_name = new TreeNode[n]; MySqlCommand cmd = new MySqlCommand("show databases", connection); MySqlDataReader dataReader =…
Bruce Rox
  • 21
  • 5
1
vote
1 answer

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…
Igor
  • 1,414
  • 4
  • 21
  • 43
1
vote
1 answer

MySqlDataReader in C# has no rows

I'm trying to develop a little user-user messaging system in C# (my first C# app) using a mysql database. I know best practice would be to use something like EF for working with the database, but I'm writing this the "stupid" way just to get…
Ortund
  • 7,259
  • 17
  • 59
  • 125
1
vote
4 answers

mysql data read returning 0 rows from class

I am implementing a database manager class within my app, mainly because there are 3 databases to connect to one being a local one. However the return function isn't working, I know the query brings back rows but when it is returned by the class it…
Neo
  • 2,098
  • 4
  • 33
  • 63
0
votes
0 answers

MySqlDataReader Hasn't Row But Query has data

My Query in PHPmyadmin has result but in C#, a.read() returns no data. string query = "SELECT answer FROM tbl WHERE level = " + level + " AND subject = '" + subject[i] + "';"; MySqlCommand command = new MySqlCommand(query,…
seyed
  • 21
  • 5
0
votes
1 answer

Read the contents of a column several times with Mysql datareader

I am creating a console application that outputs the contents of the "password" column and the "username" column. Does anyone know how I could rewrite the output every time new data appears on the password and username rows? I had thought about…
0
votes
1 answer

SqlBulkCopy, MySqlDataReader, BLOB, and IndexOutOfRangeException

So, I am hitting infamous IndexOutOfRangeException when using MySqlDataReader with BLOB columns. My situation is quite specific though. The story is following. I am pulling data from MySQL into SQL Server via first getting MySqlDataReader from…
Oleksandr
  • 292
  • 1
  • 4
  • 14
0
votes
1 answer

Getting Exception Input String was not in a correct format

I am building a windows service with ASP.NET C#. I am trying to make a call from a MySQl database using MySqlCommand object. I try to retrieve data from a table called tbl_patient in my database. When I pass the following query to my MySQlCommand…
0
votes
1 answer

Converting XLS to PDF: Getting "Data index must be a valid index in the field" exception during GetBytes()

I have an application that converts files into PDF. It first saves a blob from MySQL into a temp file and then it converts that temp file into a PDF. I'm getting this "Data index must be a valid index in the field" exception error at the GetBytes()…
E. Choi
  • 763
  • 1
  • 6
  • 7
0
votes
1 answer

C# MySQLDataReader returns column names instead of field values

I am using MySQLClient with a local database. I wrote a method which returns a list of data about the user, where I specify the columns I want the data from and it generates the query dynamically. However, the reader is only returning the column…
aidan byrne
  • 130
  • 7