protected void btnHRegister_Click(object sender, EventArgs e) { string imagefile = "notavailable.jpg"; if (FileUpload3.HasFile) //checking whether the file upload has the file { imagefile = FileUpload3.FileName; FileUpload3.SaveAs(Server.MapPath("~/images/" + imagefile));//store the file in the images folder } //hotel Random rndRandom = new Random(); int newLicNo = rndRandom.Next(1, 1000); Hotel h = new Hotel() { OrgEmail = tbxHEmail.Text, Name = tbxHName.Text, RegID = tbxHRegID.Text, Address = tbxHAddress.Text, PostalCode = tbxHPostalCode.Text, City = tbxHCity.Text, Country = tbxHCountry.Text, Password = tbxHPassword.Text, ContactNo = tbxHPhone.Text, Description = "Not Applicable", License = "SH" + newLicNo, StarRating = Convert.ToInt32(5), Photo = imagefile, Verification = false }; int id = HotelDB.insertHotel(h); lblOutput.Text = id + "Registered Successfully!"; }