本帖最后由 恒鑫电脑 于 2020-1-16 12:09 编辑
工厂的许多产品都贴有二维码,为了快速识别产品是否正确,开发了这个软件。
1.选择类别,进行内容登记,录入正确的条码
2.在输入框进行扫描即可进行比对
话不多说 上图
成品图
附上源代码
Module Module1
'Public A(1000) As String
'Public B(1000) As String
'Public C(1000) As String
'Public D(1000) As String
'Public i_A As Integer
'Public i_B As Integer
'Public i_C As Integer
Public i_D As Integer
Public LocalSqlConn As OleDb.OleDbConnection
'Public strUserName As String
'Public strClass As String
Public Function GetLocalSqlConn() As Boolean
GetLocalSqlConn = False
Try
LocalSqlConn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=" & Application.StartupPath & "\database.mdb")
LocalSqlConn.Open()
GetLocalSqlConn = True
Catch ex As Exception
GetLocalSqlConn = False
End Try
End Function
'Public Function GetDs(ByVal strsql As String, ByVal strtable As String) As DataSet
' Try
' Dim sqlda As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(strsql, LocalSqlConn)
' Dim myds As New DataSet
' sqlda.Fill(myds, strtable)
' GetDs = myds
' sqlda.Dispose()
' Catch ex As Exception
' GetDs = Nothing
' End Try
'End Function
Public Function GetTab(ByVal strsql As String, ByVal strtable As String) As DataTable
Try
Dim sqlda As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(strsql, LocalSqlConn)
Dim myds As New DataSet
sqlda.Fill(myds, strtable)
GetTab = myds.Tables(0)
myds.Dispose()
sqlda.Dispose()
Catch ex As Exception
GetTab = Nothing
End Try
End Function
Public Function GetCom(ByVal strsql As String) As Boolean
Try
Dim sqlcom As OleDb.OleDbCommand = New OleDb.OleDbCommand(strsql, LocalSqlConn)
sqlcom.ExecuteNonQuery()
sqlcom.Dispose()
GetCom = True
Catch ex As Exception
GetCom = False
End Try
End Function
End Module
|