I am using 3 tier architecture in my C# Window Form. The thing I want to do is, hide the button if the data is exists. Here are my codes.
Class File
public bool checkIfExists(Variables variables) { // BelPar
SqlCommand check = new SqlCommand();
check.Connection = dbcon.getcon();
check.CommandType = CommandType.Text;
check.CommandText = "SELECT * FROM tbl";
SqlDataReader drCheck = check.ExecuteReader();
if(drCheck.HasRows == true)
{
drCheck.Read();
if (... && .. ||) // conditions where variables are being fetch
{
return false;
}
}
drCheck.Close();
return true;
}
Window Form
btn_save.Visible = !balpayrolldetails.checkIfExists(); // This is where I get the "No overload for method 'checkIfExists' takes 0 arguments.
Any help? Please leave or answer below. Thank you