Hello I have an mysql table that have 8 columns!
I wand to read one of the column (tameio) and display the raws in a list box
string MyConString = "SERVER=192.168.0.1;" + "DATABASE=mydata;" + "UID=user;" + "PASSWORD=123456;";
string netselect = "mytable";
MySqlConnection connection = new MySqlConnection(MyConString);
MySqlCommand command = connection.CreateCommand();
MySqlDataReader Reader;
command.CommandText = "select table.tameio from table";
connection.Open();
Reader = command.ExecuteReader();
label6.ForeColor = System.Drawing.Color.Lime;
label6.Text = "SERVER ONLINE ";
while (Reader.Read())
{
string thisrow = "";
for (int i = 0; i < Reader.FieldCount; i++)
thisrow += Reader.GetValue(i).ToString();
listBox1.Items.Add(thisrow);
}
connection.Close();
but in listbox i get only the first raw
any help?????

3 answers
did you make a debug for that? if you did and it only looped once then the result is right and you code here is right so check the connection ip and database if its taking data from a different database or server and check the table itself if it only has one row.
answered one year ago by:
1556
its ok the code work the problem is in some raws i have null content!
is any way to ignore the null -empty content and to move to next raw?
answered one year ago by:
30
Try changing the query to:
Incidentally, 'table' is a reserved word in MySql so I assume your actual table name is something else.
answered one year ago by:
17279