哪位能把这段VB代码转换成Java代码
FileNameStr="\\10.33.18.78"&"\pic\"'职工的照片必须放入FileName=FileNameStr&strPersonCode&".jpg...
FileNameStr = "\\10.33.18.78" & "\pic\"
'职工的照片必须放入
FileName = FileNameStr & strPersonCode & ".jpg" '职工编号.jpg
If ofile.FileExists(FileName) = False Then
'抛错误信息
pdoData = strPersonCode + "," + Format(Now, "YYYYMMDD") + ",照片不存在," + "E"
strsql = "insert into tbdipdo (TimeStamp,SerialNo,QueueId,Header,Data,Status) values (" & _
"'" & DateDiff("s", "1970-01-01 00:00:00", Now) & "'" & _
",'1'" & _
",'HD002'" & _
",'门禁系统'" & _
",'" & pdoData & "'" & _
",'N'" & _
")"
SevCn.Execute strsql
UdtRs.Fields("Status") = "E"
UdtRs.Fields("ProcessTime") = Format(Now, "YYYYMMDDHHMMSS")
UdtRs.Fields("Description") = "找不到次职工照片"
GoTo aa
End If
'////////////////////////////////////////////////////////////////////////
If (iOk = 1) Then
strsql = " select accountno from TB_Picture " & _
" where accountno='" & strAccountNo & "'"
Set rs = New Recordset
rs.Open strsql, SevCn, adOpenStatic, adLockOptimistic
If Not rs.EOF Then
SevCn.Execute "delete from TB_Picture where accountno='" & strAccountNo & "'"
End If
strsql = "select accountno,picture from TB_Picture where 1=2 "
Set rs = New Recordset
rs.Open strsql, SevCn, adOpenStatic, adLockOptimistic
otextStream.Mode = adModeReadWrite
otextStream.Type = adTypeBinary
otextStream.Open
otextStream.LoadFromFile (FileName)
rs.AddNew
rs.Fields("picture") = otextStream.Read
rs.Fields("accountno") = strAccountNo
rs.Update
rs.Close
Set otextStream = Nothing
'Kill FileName
UdtRs.Fields("STATUS") = "0"
UdtRs.Fields("ProcessTime") = Format(Now, "YYYYMMDDHHMMSS")
UdtRs.Fields("Description") = "数据导入成功,等待办卡"
End If
SevCn.CommitTrans 展开
'职工的照片必须放入
FileName = FileNameStr & strPersonCode & ".jpg" '职工编号.jpg
If ofile.FileExists(FileName) = False Then
'抛错误信息
pdoData = strPersonCode + "," + Format(Now, "YYYYMMDD") + ",照片不存在," + "E"
strsql = "insert into tbdipdo (TimeStamp,SerialNo,QueueId,Header,Data,Status) values (" & _
"'" & DateDiff("s", "1970-01-01 00:00:00", Now) & "'" & _
",'1'" & _
",'HD002'" & _
",'门禁系统'" & _
",'" & pdoData & "'" & _
",'N'" & _
")"
SevCn.Execute strsql
UdtRs.Fields("Status") = "E"
UdtRs.Fields("ProcessTime") = Format(Now, "YYYYMMDDHHMMSS")
UdtRs.Fields("Description") = "找不到次职工照片"
GoTo aa
End If
'////////////////////////////////////////////////////////////////////////
If (iOk = 1) Then
strsql = " select accountno from TB_Picture " & _
" where accountno='" & strAccountNo & "'"
Set rs = New Recordset
rs.Open strsql, SevCn, adOpenStatic, adLockOptimistic
If Not rs.EOF Then
SevCn.Execute "delete from TB_Picture where accountno='" & strAccountNo & "'"
End If
strsql = "select accountno,picture from TB_Picture where 1=2 "
Set rs = New Recordset
rs.Open strsql, SevCn, adOpenStatic, adLockOptimistic
otextStream.Mode = adModeReadWrite
otextStream.Type = adTypeBinary
otextStream.Open
otextStream.LoadFromFile (FileName)
rs.AddNew
rs.Fields("picture") = otextStream.Read
rs.Fields("accountno") = strAccountNo
rs.Update
rs.Close
Set otextStream = Nothing
'Kill FileName
UdtRs.Fields("STATUS") = "0"
UdtRs.Fields("ProcessTime") = Format(Now, "YYYYMMDDHHMMSS")
UdtRs.Fields("Description") = "数据导入成功,等待办卡"
End If
SevCn.CommitTrans 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询