也拷贝过去了,窗口的图片控件也能显示,就是在数据表里没有,我把窗口的timertrick事件的代码复制下来,是这样的:
For i As Integer = 1001 To 1001
Dim portflag As Integer = 1001
'变量声明
Dim CardPUCIIN As Byte() = New Byte(254) {}
Dim pucManaMsg As Byte() = New Byte(254) {}
Dim pucCHMsg As Byte() = New Byte(254) {}
Dim pucPHMsg As Byte() = New Byte(3023) {}
Dim puiCHMsgLen As UInt32 = 0
Dim puiPHMsgLen As UInt32 = 0
Dim st As Integer = 0
'读卡操作
st = SDT_StartFindIDCard(portflag, CardPUCIIN, 1)
If st <> &H9f Then
Continue For
End If
st = SDT_SelectIDCard(portflag, pucManaMsg, 1)
If st <> &H90 Then
Continue For
End If
st = SDT_ReadBaseMsg(portflag, pucCHMsg, puiCHMsgLen, pucPHMsg, puiPHMsgLen, 1)
If st <> &H90 Then
Continue For
End If
Dim s As String =(System.Text.ASCIIEncoding.Unicode.GetString(pucCHMsg))
If s.Length > 0 Then
'分段截取字符串并赋给窗口控件
Dim r As Row = Tables("农民工实名制信息表").AddNew
r("姓名") = s.SubString(0,14).Replace(".","-")
r("性别") = s.SubString(15,1).Replace(".","-")
r("民族") = s.SubString(16,2).Replace(".","-")
Dim tmp As String = s.Substring(18, 8).Replace(".", "-")
r("出生日期") = (tmp.Substring(0, 4)) & "年" & (tmp.Substring(4, 2)) & "月" & (tmp.Substring(6, 2)) & "日"
r("家庭住址") = s.SubString(26,35).Replace(".","-")
r("身份证号") = s.SubString(61,18).Replace(".","-")
r("发证机关") = s.SubString(79,14).Replace(".","-")
tmp = s.SubString(94,8).Replace(".","-")
r("签发日期") = (tmp.Substring(0, 4)) & "年" & (tmp.Substring(4, 2)) & "月" & (tmp.Substring(6, 2)) & "日"
tmp = s.SubString(102,8).Replace(".","-")
r("有效日期") = (tmp.Substring(0, 4)) & "年" & (tmp.Substring(4, 2)) & "月" & (tmp.Substring(6, 2)) & "日"
If (filesys.FileExists(ProjectPath & "zp.wlt")) Then
'删除
FileSys.DeleteFile(ProjectPath & "zp.wlt",2,3)
End If
system.io.File.WriteAllBytes(ProjectPath & "zp.wlt", pucPHMsg)
Select Case GetBmp(ProjectPath & "zp.wlt", 2)
Case 0
MessageBox.Show("调用sdtapi.dll错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
Exit Select
Case 1
'正常
Exit Select
Case -1
MessageBox.Show("相片解码错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
Exit Select
Case -2
MessageBox.Show("wlt文件后缀错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
Exit Select
Case -3
MessageBox.Show("wlt文件打开错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
Exit Select
Case -4
MessageBox.Show("wlt文件格式错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
Exit Select
Case -5
MessageBox.Show("软件未授权!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
Exit Select
Case -6
MessageBox.Show("设备连接错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.[Error])
Exit Select
End Select
If (filesys.FileExists(ProjectPath & "zp.bmp")) Then
FileSys.CopyFile(ProjectPath & "zp.bmp", ProjectPath & "\Attachments\" & r("身份证号") & ".bmp",True) '照片复制到Attachments目录
e.Form.Controls("PictureBox1").imagefile = ProjectPath & "zp.bmp"
End If
End If
Next