Skip navigation links

MySQL Forums


Advanced Search

View seareched rows in MySQL databas
Posted by: Stefan Eriksson ()
Date: November 15, 2008 01:14PM

I'm trying to view some results from my MySQL database in a C# Windows application.

I included the: "MySQL.Data.MySQLClient" in my application and I have send the "SELECT"-statement to the MySQL-server. The statement works, I have checked it in Query Browser. The result shows two rows, which I want.

Now I want to store each row and each colums with it, in a C# dictionary.
The problem is, the code I'm using only store in row in the dictionary, the last row which was found with the "SELECT"-statement is not stored in the dictionary. How do I solve this?

I use this code in my C# application to store the data into my dictionary:

Dictionary<int, Collection<string>> rowData = new Dictionary<int, Collection<string>>();
int rowIndex = 0;

// The code to with the "SELECT"-statement is send to the MySQL-server.

while (mySQLReader.Read()) // mySQLReader is a variable of MySQLDataReader.
{
rowData[rowIndex] = new Collection<string>();

for (int i = 0; i < 5; i++)
{
rowData[rowIndex].Add(mySQLReader.GetString(i));
}

mySQLReader.NextResult(); // Don't know it this do anyting.
rowIndex++;
}

Please help.

Options: ReplyQuote


Subject Written By Posted
View seareched rows in MySQL databas Stefan Eriksson 11/15/2008 01:14PM


Sorry, you can't reply to this topic. It has been closed.