private void button2_Click(object sender, EventArgs e)//Print button
 {
     try{
         string serv = "localhost", database = "namefield", uid = "root", pasw = "121417181";
         string constring;
         constring = "SERVER=" + serv + ";" + "DATABASE=" + database + ";" + "UID=" + uid + ";" + "PASSWORD="******";";
         MySqlConnection connection = new MySqlConnection(constring);
         connection.Open();
         string       query         = "select * from bill where usrid='" + usid + "';";
         MySqlCommand cmd           = new MySqlCommand(query, connection);
         //Execute a SQL command to read ,which uses class "MySqlDataReader" as a command for ExecuteReader using cmd
         MySqlDataReader read = cmd.ExecuteReader();
         while (read.Read())
         {
             if (read.GetInt32("paid") == 0)
             {
                 flag = 1;
             }
             else
             {
                 flag = 0;
             }
         }
         read.Close();
         if (flag == 1)
         {
             cmd.CommandText = "update bill set paid=" + paid + " where usrid=" + usid + ";";
             cmd.ExecuteNonQuery();
         }
         else
         {
             cmd.CommandText = "insert into bill (usrid,total,paid) values (" + usid + "," + total + "," + paid + ");";
             cmd.ExecuteNonQuery();
         }
         Print f9 = new Print();
         f9.Vehino = vhno;//Intha edathula send pandrom
         f9.ShowDialog();
     }
     catch (MySqlException ex)
     {
         MessageBox.Show("The error occured is" + ex);
         this.Close();
     }
 }