How can I display a result of a query in a textbox instead of a datatable or a grid? The result is only a number (Select SUM()...) that should be displayed in a formatted textbox.
Should I use the MySqlText object or is there a quick solution for this?
Thanks!!
Query result displayed in a textbox instead datatable?
You may use MySqlDataReader object to return the number
and then assign that number to a TextBox like this:(Select SUM()...)
Code: Select all
textBox1.Text = reader[0].ToString();
I see this error first time.
Try to use the following statement:
Try to use the following statement:
Code: Select all
textBox1.Text = mySqlCommand1.ExecuteScalar().ToString();