Answer the question
In order to leave comments, you need to log in
Where to store query result from mysql, buffering?
1) Now I'm just outputting data, but where is it usually stored? In structure, collection?
MySqlConnection connect = new MySqlConnection("server=localhost;user=root;password=1;database=test");
connect.Open();
string sql = "SELECT * FROM TABLE1";
MySqlCommand command = new MySqlCommand(sql, connect);
MySqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
for (int i = 0; i < reader.FieldCount; i++)
{
Console.Write($"{reader[i]}\t");
}
Console.WriteLine();
}
reader.Close();
connect.Close();
Answer the question
In order to leave comments, you need to log in
If you received line by line from the server, then the method Read
would be asynchronous, but it is not. For storage, you describe the data model and fill it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question