I need help. I spent many hours to research my problem but I could not figure out.
My application is client-Server. It installs on COM server (Application Server with all dlls), Window Server 2008 (Application.exe) and Sql Server 2008.
My function to call the function in COM server to read the text file, convert to document image and insert record to Image Field to table.
The function to read file as binary does not work because it always insert NULL to the image field.
I trap the error and there is no error message to display at all.
I check all the folders and file access and my user has full control.
Any file locking from window server 2008 for user under domain?
Below are my codes:
dim oImageField As ADODB.Field
Open Filename For Binary Access Read As SourceFile
FileLength = LOF(SourceFile)
If FileLength = 0 Then
Close SourceFile
Exit Sub
End If
NumBlocks = FileLength \ BlockSize
LeftOver = FileLength Mod BlockSize
oImageField.AppendChunk ""
ReDim ByteData(LeftOver)
Get SourceFile, , ByteData()
oImageField.AppendChunk ByteData()
ReDim ByteData(BlockSize)
For i = 1 To NumBlocks
Get SourceFile, , ByteData()
oImageField.AppendChunk ByteData()
Next i
If Not (blnIsPdf) Then
If LeftOver > 0 Then
ReDim ByteData(LeftOver)
Get SourceFile, , ByteData()
oImageField.AppendChunk ByteData()
End If
End If
Close SourceFile
Exit Sub
It looks like it opens the file for Binary Access Read then it checks FileLength and it returns 0 so it never convert to binary and append to the oImageField. The problem is only happen on one client. I do not know how to check Client-Server with COM server and Window 2008 server and domain users for file access. If you know how to fix it please let me know. Please email me at babaongu2011@yahoo.com.
Thanks so much!
My application is client-Server. It installs on COM server (Application Server with all dlls), Window Server 2008 (Application.exe) and Sql Server 2008.
My function to call the function in COM server to read the text file, convert to document image and insert record to Image Field to table.
The function to read file as binary does not work because it always insert NULL to the image field.
I trap the error and there is no error message to display at all.
I check all the folders and file access and my user has full control.
Any file locking from window server 2008 for user under domain?
Below are my codes:
dim oImageField As ADODB.Field
Open Filename For Binary Access Read As SourceFile
FileLength = LOF(SourceFile)
If FileLength = 0 Then
Close SourceFile
Exit Sub
End If
NumBlocks = FileLength \ BlockSize
LeftOver = FileLength Mod BlockSize
oImageField.AppendChunk ""
ReDim ByteData(LeftOver)
Get SourceFile, , ByteData()
oImageField.AppendChunk ByteData()
ReDim ByteData(BlockSize)
For i = 1 To NumBlocks
Get SourceFile, , ByteData()
oImageField.AppendChunk ByteData()
Next i
If Not (blnIsPdf) Then
If LeftOver > 0 Then
ReDim ByteData(LeftOver)
Get SourceFile, , ByteData()
oImageField.AppendChunk ByteData()
End If
End If
Close SourceFile
Exit Sub
It looks like it opens the file for Binary Access Read then it checks FileLength and it returns 0 so it never convert to binary and append to the oImageField. The problem is only happen on one client. I do not know how to check Client-Server with COM server and Window 2008 server and domain users for file access. If you know how to fix it please let me know. Please email me at babaongu2011@yahoo.com.
Thanks so much!