With my below code , I get error as
Invalid operation. The connection is closed.
Here is the code
[WebMethod]
public static bool DoesDataExist(string proj, string surv)
{
OracleCommand commandrepeat1 = new OracleCommand("Select * from XXCUS.XXACL_PN_FARMING_MST where project=" + proj + " and Survey=" + surv + " ");
string constr = ConfigurationManager.ConnectionStrings["OracleConn"].ConnectionString;
OracleConnection con = new OracleConnection(constr);
con.Close();
con.Open();
OracleDataReader drmax1;
drmax1 = commandrepeat1.ExecuteReader();
drmax1.Read();
if (drmax1.HasRows)
{
con.Close();
return true;
}
con.Close();
return false;
}
Invalid operation. The connection is closed.
Here is the code
[WebMethod]
public static bool DoesDataExist(string proj, string surv)
{
OracleCommand commandrepeat1 = new OracleCommand("Select * from XXCUS.XXACL_PN_FARMING_MST where project=" + proj + " and Survey=" + surv + " ");
string constr = ConfigurationManager.ConnectionStrings["OracleConn"].ConnectionString;
OracleConnection con = new OracleConnection(constr);
con.Close();
con.Open();
OracleDataReader drmax1;
drmax1 = commandrepeat1.ExecuteReader();
drmax1.Read();
if (drmax1.HasRows)
{
con.Close();
return true;
}
con.Close();
return false;
}