请高手帮我看看,代码错在哪?为何读两次MD5?
代码是接收完文件,再读MD5,然后进行判断
下面的IF...THEN...ELSE...IF...THEN...ELSE...ENDIF ENDIF
有错误吗?
错在哪?
Static Size As Long
If Size = 0 Then
Open App.Path & "\MirGet(" & CStr(Index) & ").bmp" For Binary As #1
Size = 1
End If
TcpServer(Index).GetData B
TxtClientIP1.Text = TcpServer(Index).RemoteHostIP
TxtClientPort1.Text = TcpServer(Index).RemotePort
Size = Size + bytesTotal
If Size >= 14454 Then '改成传文件的大小
Put #1, , B
Close #1
Size = 0
TcpClient.Connect TxtClientIP1.Text, 2002
MirMD5.Text = HashFile(App.Path & "\MirGet(" & CStr(Index) & ").bmp")
MirMdb.CursorLocation = adUseClient
MirMdb.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Files\VB98\MirImage.mdb;Persist Security Info=False"
MirMdb.CommandTimeout = 30
MirMdb.Open
If MirRs.State <> adStateClosed Then MirRs.Close
MirRs.Open "SELECT * FROM MirImage01 Where MirMD5 = '" & MirMD5.Text & "'", MirMdb, adOpenStatic, adLockOptimistic
If MirRs.RecordCount >= 1 Then
TxtSend1.Text = MirRs.Fields("MirAnswer").Value
TcpClient.SendData TxtSend1.Text
Else
PicRecieve1.Picture = LoadPicture(App.Path & "\MirGet(" & CStr(Index) & ").bmp")
Beep 500, 100
End If
Else
Put #1, , B
End If
代码是接收完文件,再读MD5,然后进行判断
下面的IF...THEN...ELSE...IF...THEN...ELSE...ENDIF ENDIF
有错误吗?
错在哪?
Static Size As Long
If Size = 0 Then
Open App.Path & "\MirGet(" & CStr(Index) & ").bmp" For Binary As #1
Size = 1
End If
TcpServer(Index).GetData B
TxtClientIP1.Text = TcpServer(Index).RemoteHostIP
TxtClientPort1.Text = TcpServer(Index).RemotePort
Size = Size + bytesTotal
If Size >= 14454 Then '改成传文件的大小
Put #1, , B
Close #1
Size = 0
TcpClient.Connect TxtClientIP1.Text, 2002
MirMD5.Text = HashFile(App.Path & "\MirGet(" & CStr(Index) & ").bmp")
MirMdb.CursorLocation = adUseClient
MirMdb.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Files\VB98\MirImage.mdb;Persist Security Info=False"
MirMdb.CommandTimeout = 30
MirMdb.Open
If MirRs.State <> adStateClosed Then MirRs.Close
MirRs.Open "SELECT * FROM MirImage01 Where MirMD5 = '" & MirMD5.Text & "'", MirMdb, adOpenStatic, adLockOptimistic
If MirRs.RecordCount >= 1 Then
TxtSend1.Text = MirRs.Fields("MirAnswer").Value
TcpClient.SendData TxtSend1.Text
Else
PicRecieve1.Picture = LoadPicture(App.Path & "\MirGet(" & CStr(Index) & ").bmp")
Beep 500, 100
End If
Else
Put #1, , B
End If
If MirRs.RecordCount >= 1 Then
这代码错在哪啊??
去掉这段代码就能正常运行