D
Devhead
i have an MS Word Document that i have created from an SQL server db and
once created it is opened. If i try to create the same document with the
same filename, i get an error. how do i check to see if this document is
already opened and if so, close it before i attempted to overwrite it. a
code snippet would be helpful. my code as it currently exists follows:
public static void Blob2File(byte[] aDataColumn)
{
byte[] byteBlob;
FileStream fs = null;
//blob field
byteBlob = aDataColumn;
//try-catch added to trap exception when user attempts create document that
is already open
//however, re-examine at a later time. would like to open current document
and not open another document as a copy.
fs = new FileStream(FilePath, FileMode.Create);
fs.Write(byteBlob,0,byteBlob.Length);
fs.Close();
}
once created it is opened. If i try to create the same document with the
same filename, i get an error. how do i check to see if this document is
already opened and if so, close it before i attempted to overwrite it. a
code snippet would be helpful. my code as it currently exists follows:
public static void Blob2File(byte[] aDataColumn)
{
byte[] byteBlob;
FileStream fs = null;
//blob field
byteBlob = aDataColumn;
//try-catch added to trap exception when user attempts create document that
is already open
//however, re-examine at a later time. would like to open current document
and not open another document as a copy.
fs = new FileStream(FilePath, FileMode.Create);
fs.Write(byteBlob,0,byteBlob.Length);
fs.Close();
}