public bool UpdateDoc(string xmlDocument, string UUID)
{
string sqlStatement = "UPDATE DOCUMENT SET XML_DOC = :xmlDoc_var WHERE UUID = :UUID_var";
//This is a helper class that returns an OracleConnection object
OracleConnection conn = Helper.getConnectionObject();
try
{
//Set the OracleCommand object and open the connection
OracleCommand oraCommand = new OracleCommand(sqlStatement, conn);
conn.Open();
//Create the OracleXmlType object and set it to the xmlDocument
//passed into the method
OracleXmlType xmlType = new OracleXmlType(conn, xmlDocument);
//Set the bind variables
oraCommand.Parameters.Add(":xmlDoc_var", xmlType);
oraCommand.Parameters.Add(":UUID_var", UUID);
//Execute the query
int result = oraCommand.ExecuteNonQuery();
conn.Close();
oraCommand.Dispose();
return true;
}
catch (Exception e)
{
Helper.logError(e);
if (null != conn && conn.State == ConnectionState.Open) conn.Close();
return false;
}
}
|