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
3 answers

c# mysql query with select distinct column

I am trying to put the DISTINCT rows (which is a small string) in a string variable targeting a textbox, but it only returns some of the rows with different content in the column. I used similar code but targeting a datagridview and works ok. I…
0
votes
2 answers

MySqlDataReader NullReferenceException after update

I get a System.NullReferenceException when I'm using MySqlDataReader after I've inserted or updated something in the database. Here is my code: protected void Page_Load(object sender, EventArgs e) { using (var conn = new…
0
votes
3 answers

Object reference not set to an instance of an object [C#]

I am getting the following error: Object reference not set to an instance of an object I don't know what is the cause of this error and how to solve it, here is my code: while(dr.Read()) { string variant = dr.GetString(0); int size =…
Harvey
  • 399
  • 4
  • 15
  • 31
0
votes
1 answer

how to retrieve data in mySQL and put it in specific cell in the datagridview

I want to put the column quantity from my database in the datagridview which in the first place has data loaded in it, 5 columns together with the column quantity. Now I tried to load the column quantity in my database. Here is my code: using…
Harvey
  • 399
  • 4
  • 15
  • 31
0
votes
3 answers

Counting a specific number of records using MySqlDataReader

I have this code that counts the number of records with the same year and date. But when I run the application it doesn't work. Here is my code: try { string query = "SELECT * FROM tblOrder WHERE dateTime_coded=@dateTimeNow"; MySqlCommand…
Harvey
  • 399
  • 4
  • 15
  • 31
0
votes
1 answer

Query not returning all records, need all records

I have written some code for retrieving 3 seperate columns from my database, yet for some reason it isn't loading all of the records which result from my query. Or well, at least it doesn't seem to do so. Also, for some reason it won't show me a…
Yorrick
  • 377
  • 2
  • 8
  • 28
0
votes
1 answer

MySql, passing datareader, closing connections

I know this is been asked in one for or another but I really can't find the best explanation. I have a MySql DataReader function which is supposed to get one row from DB and return it "as is" because I want to process the data somewhere else Private…
user1973900
  • 381
  • 4
  • 18
0
votes
4 answers

Cache mysql results c#

Is there a way to cache the results of a MySQL query, specifically a data-reader? I have some mundane queries that really only need to be performed once when the application is loaded, then each form can use the cache values instead of querying the…
Neo
  • 2,305
  • 4
  • 36
  • 70
0
votes
1 answer

MySqlDataReader method for getting boolean values

I'm retrieving data from a MySQL table and displaying it on a webpage using MySqlDataReader and .NET (C#), with no trouble retrieving simple text data, but I'm having trouble retrieving data from a boolean column, as the possible values are either…
mmmoustache
  • 2,273
  • 6
  • 41
  • 62
-1
votes
2 answers

Using MySqlDataReader C#

I'm trying to use mysqldatareader to fill some textboxes in C# Visual Studio. I've made the connection string and created the MySqlDataReader command. But when I click in the button to make the action it shows me a messagebox saying: "Invalid…
-1
votes
1 answer

MySqlDataReader cast function, wpf

I want to cast reader from mysqldatareader to list of specific object. So i use the function cast but it doesn't work, i have an exception. enter image description here This is the class of objectenter image description here
DGentile
  • 1
  • 1
-1
votes
1 answer

BackgroundWorker for fetching DataBase and put it in a DataGrid with dynamically added Columns

I read this question: BackgroundWorker to read database and update GUI And thinks, that this is a good way to solve this problem. The only thing is, that I create my Columns dynamically. I read schemaInfo from DataBase to get the ColumnNames and…
Luranis
  • 151
  • 1
  • 3
  • 10
-1
votes
1 answer

asp net core - NullReferenceException: how to return mysql data reader from method?

I've created a method to return mysql data reader. public class DbHelper : BaseService { public DbHelper(string connectionString) : base(connectionString) { } public static MySqlDataReader GetDataReader(string query) { using…
FabioBit
  • 139
  • 1
  • 4
  • 12
-1
votes
1 answer

Obtaining an Array with MysqlDataReader (Function)

I have made Function that returns List[] for mysql database by calling example[0][1] and I have to specify the Columns I wan't to fetch... i.e dbConnect = new DBConnect(); List[] userlogin; List parameters = new…
Raja Bilal
  • 87
  • 1
  • 12
-1
votes
1 answer

MysqlDataReader.Read stuck on the last record and doesnt EOF

i confused why mySqlDataReader.Read stuck on the last record and doesnt EOF .. Here's my private function for executeSql : Private Function executeSQL(ByVal str As String, ByVal connString As String, ByVal returnRecordSet As Boolean) As Object …
XMozart
  • 879
  • 2
  • 10
  • 22