Created
July 31, 2017 07:19
-
-
Save jiaming0708/8b1dc80dd8736f6015fd9768e6a08f5a to your computer and use it in GitHub Desktop.
vba
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Function CheckCompanyExist(comp As String, mac As String) As Boolean | |
Dim result As Boolean | |
Dim ADOcn As New ADODB.Connection | |
Dim ADOrt As New ADODB.Recordset | |
Dim strCn As String | |
Dim strSQL As String | |
strCn = "Provider=SQLOLEDB;Server=eshclouds-license******;Database=License;Uid=******;Pwd=*****;" | |
strSQL = "select * from ComanyInfo" | |
With ADOcn | |
.ConnectionString = strCn | |
.Open | |
Set ADOrt = .Execute(strSQL) | |
End With | |
Set ADOrt = ADOcn.Execute(strSQL) | |
If ADOrt.RecordCount > 0 Then | |
MsgBox ("有查詢到資料") | |
Else | |
MsgBox ("找不到資料") | |
End If | |
ADOrt.Close | |
ADOcn.Close | |
CheckCompanyExist = result | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment