private void addReviewButton_Click(object sender, RoutedEventArgs e) { var dlg = new ReviewItem(Isbn); DALReviewItem reviewItem = new DALReviewItem(); dlg.isbnTextBox.Text = Isbn; dlg.titleTextBox.Text = Title; //dlg.Owner = this; DBQueries dbQ = new DBQueries(); DataSet ds = new DataSet(); String s1 = "select t1.OrderID, t1.UserID from Orders " + "t1 INNER JOIN OrderItem t2 ON t1.OrderID = t2.OrderID Where t2.ISBN = '" + Isbn + "' And t1.UserID = '" + UserID + "'"; // ds = dbQ.SELECT_FROM_TABLE("SELECT * FROM BookData WHERE Title = '" + // dataGridView1.SelectedCells[0].Value.ToString() + "'"); ds = dbQ.SELECT_FROM_TABLE(s1); if (ds.Tables[0].Rows.Count > 0) { var orderID = ds.Tables[0].Rows[0]["OrderID"].ToString(); //MessageBox.Show("fetched orderID is" + orderID); //var title = ds.Tables[0].Rows[0]["Title"].ToString(); dlg.orderNoTextBox.Text = orderID; dlg.ShowDialog(); if (dlg.DialogResult == true) { if (reviewItem.Review(Isbn, int.Parse(orderID), int.Parse(dlg.ratingsbutton.Text), dlg.commentsTextBox.Text)) { MessageBox.Show("Your Review Has been submitted."); } else { MessageBox.Show("Your Review could not be added, if you have already reviewed a book you cannot leave another review"); } } } else { MessageBox.Show("You need to purchase a book to be able to review it."); } }