acssess数据库怎样导入?
发布网友
发布时间:2023-02-18 14:22
我来回答
共1个回答
热心网友
时间:2023-10-14 15:36
串口接收地BYTE数据转为16进制,注意0-9前需补0,变为00-09。统一组成2字节组成的16进制字符串,便于以后的数据处理。
Private Sub Form_Load()
MSComm2.CommPort = 2
MSComm2.InBufferSize = 1024
MSComm2.OutBufferSize = 512
MSComm2.Settings = "9600,n,8,1"
MSComm2.RThreshold = 1
MSComm2.InputMode = comInputModeBinary '二进制接收
MSComm2.PortOpen = True
Text1 = ""
End Sub
Private Sub MsComm2_OnComm()
Dim intInputLen As Integer
Select Case Me.MSComm2.CommEvent
Case comEvReceive
'处理接收的代码
intInputLen = Me.MSComm1.InBufferCount
ReDim bytInput(intInputLen)
bytInput = Me.MSComm2.Input
jieshou
End If
End Select
End Sub
Public Function jieshou() '接收数据处理为16进制
Dim i As Integer
For i = 0 To UBound(bytInput)
If Len(Hex(bytInput(i))) = 1 Then
strData = strData & "0" & Hex(bytInput(i))
Else
strData = strData & Hex(bytInput(i))
End If
Next
Text1 = strData
End Function
分段存入acssess数据库需依据通信协议按要求取数据。