A
Aaron
Ok, I assume somehow the file is locked by the system, but why it is,
I don't know. Is there anyway to still delete my file without the
following exception:
An unhandled exception of type 'System.IO.IOException' occurred in
mscorlib.dll
Additional information: IOException
Here's my function:
Dim sAppPath As String
Dim rsSignature As New InTheHand.Data.Adoce.Recordset
'get path to where we are at now
sAppPath =
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
+ "\"
'Try
'save signature image to file
signatureBox.SaveImage(sAppPath & "Signature.bmp")
'load recordset with some data
rsSignature.Open("SELECT * FROM tblServices WHERE ServiceID =
" & 69379, cn, LockType.Optimistic)
'get fileinfo from Signature.bmp
Dim bmpinfo As New FileInfo(sAppPath & "Signature.bmp")
'create byte array of correct length based on fileinfo
received above
Dim bmpbytes(bmpinfo.Length) As Byte
'create filestream from the bitmap
Dim fsbmp As New FileStream(bmpinfo.FullName, FileMode.Open)
'create binary reader opened on above filestream
Dim bmpreader As New BinaryReader(fsbmp)
'binaryreader reads entire file to byte array (up to 64k in
database field)
bmpreader.Read(bmpbytes, 0, bmpbytes.Length)
'attempt to assign the byte array to the blob field
rsSignature.Fields("Signature").Value = bmpbytes
'update the recordset
rsSignature.Update()
'Delete file from PPC
File.Delete(sAppPath & "Signature.bmp")
Sergey, is this a problem with your control you gave me advice on...is
it somehow locking the files it creates?
Thanks
I don't know. Is there anyway to still delete my file without the
following exception:
An unhandled exception of type 'System.IO.IOException' occurred in
mscorlib.dll
Additional information: IOException
Here's my function:
Dim sAppPath As String
Dim rsSignature As New InTheHand.Data.Adoce.Recordset
'get path to where we are at now
sAppPath =
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
+ "\"
'Try
'save signature image to file
signatureBox.SaveImage(sAppPath & "Signature.bmp")
'load recordset with some data
rsSignature.Open("SELECT * FROM tblServices WHERE ServiceID =
" & 69379, cn, LockType.Optimistic)
'get fileinfo from Signature.bmp
Dim bmpinfo As New FileInfo(sAppPath & "Signature.bmp")
'create byte array of correct length based on fileinfo
received above
Dim bmpbytes(bmpinfo.Length) As Byte
'create filestream from the bitmap
Dim fsbmp As New FileStream(bmpinfo.FullName, FileMode.Open)
'create binary reader opened on above filestream
Dim bmpreader As New BinaryReader(fsbmp)
'binaryreader reads entire file to byte array (up to 64k in
database field)
bmpreader.Read(bmpbytes, 0, bmpbytes.Length)
'attempt to assign the byte array to the blob field
rsSignature.Fields("Signature").Value = bmpbytes
'update the recordset
rsSignature.Update()
'Delete file from PPC
File.Delete(sAppPath & "Signature.bmp")
Sergey, is this a problem with your control you gave me advice on...is
it somehow locking the files it creates?
Thanks