private void ReportViewLogin() { if (EmployeeName_TextBox.Text == "" && DMPID_TextBox.Text == "") { ListBox.Items.Add("Please Enter Your Name and DMP ID to Login"); } else if (EmployeeName_TextBox.Text == "") { ListBox.Items.Add("Enter Employee Name to Login"); } else if (DMPID_TextBox.Text == "") { ListBox.Items.Add("Enter DMP ID to Login"); } else if (EmployeeName_TextBox.Text != "" && DMPID_TextBox.Text != "") { try { SqlConnection ReportLogin = new SqlConnection(SQL_Connection); SqlCommand Login_Command = new SqlCommand("Select * from [dbo].[Employee] where EmployeeName=@EmployeeName and DMPID=@DMPID", ReportLogin); Login_Command.Parameters.AddWithValue("@EmployeeName", EmployeeName_TextBox.Text); Login_Command.Parameters.AddWithValue("@DMPID", DMPID_TextBox.Text); ReportLogin.Open(); SqlDataAdapter adapt = new SqlDataAdapter(Login_Command); DataSet ds = new DataSet(); adapt.Fill(ds); LoginGridView.DataSource = ds.Tables[0]; ReportLogin.Close(); int count = ds.Tables[0].Rows.Count; if (count == 1) { ReportViewer ReportView = new ReportViewer(); ReportView.User_TextBox.Text = EmployeeName_TextBox.Text; ReportView.Clock_TextBox.Text = Clock_TextBox.Text; ReportView.DMPID_TextBox.Text = DMPID_TextBox.Text; ListBox.Items.Clear(); ReportView.Show(); ReportView.Focus(); OpenNewForm(); } else { ListBox.Items.Add("Access to Report View Denied."); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }