title: Unable to fetch data from phpMyadmin using data table
body: <p>I am creating a hotel management system, in which i am supposed to fetch the room for a specific reason. I am fetching <code>room_NO</code> from booking table using <code>tourist_CNIC</code> field from the same table. But i always get 0, instead of getting proper room number, which i have assigned to all of the rooms. Bellow is my code:</p>
  
  <pre><code> private int Fetch_Room()
           {
               int number = 0;
               try
               {
                   String str = "SELECT room_NO FROM booking WHERE tourist_CNIC='" + cnic.Content.ToString() + "'";
                   MySqlDataAdapter da = new MySqlDataAdapter(str, con);
                   DataTable dt = new DataTable();
                   da.Fill(dt);
                   foreach(DataRow row in dt.Rows)
                       number = Convert.ToInt32(row.ItemArray[0]);
                   return number;
               }
               catch (Exception x) { MessageBox.Show("Error: " + x.Message); return number; }
           }
  </code></pre>