3
Answers

showing information from database automatically...

Hi!

I have two forms ("entry" and "reservation").
I have one database with have two columns ("datereservation" and "names").
In opening the "entry" form if there is any reservation date today, the "reservation" form should open automatically. In other case its couldnot.
Please have a look on my codes:


string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\hotel\hotel\\app_data\reservation.mdb;Persist Security Info=False";
            OleDbConnection sqlCon = new OleDbConnection(connectionString);
            sqlCon.Open();
            string commandString = "select * from reservation where datereservation ='" + DateTime.Now + "'";
            OleDbCommand sqlCmd = new OleDbCommand(commandString, sqlCon);
            OleDbDataReader read = sqlCmd.ExecuteReader();
            {
                MessageBox.Show("There is no reservation " + DateTime.Now + " encontrada(s)");
            }

            read.Close();
            sqlCon.Close();
            
            RptReservation reserv = new RptReservation ();
            reserv.ShowDialog();
Answers (3)