Quantcast
Channel: Oracle, MySQL, Sybase, Informix and other databases
Viewing all articles
Browse latest Browse all 1350

Invalid operation. The connection is closed error

$
0
0
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;
}

Viewing all articles
Browse latest Browse all 1350

Latest Images

Trending Articles



Latest Images