comparer variable dim server sql
bonjour, je souhaite comparer une variable dim qui sera différente sur chaque ordinateur (id processeur, id hdd, id mb,id mac) avec ma base de données sql. si elle est enregistrer sur mon server le soft s'ouvre sinon il se ferme. j'ai passez plusieurs jours je ne trouve pas.. voila mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim web As New WebClient
Dim hw As New ClsComputerInfo
Dim hdd As String
Dim cpu As String
Dim mb As String
Dim mac As String
Dim hwid As String
cpu = hw.GetProcessorId()
hdd = hw.GetVolumeSerial("C")
mb = hw.GetMotherBoardID()
mac = hw.GetMACAddress()
hwid = cpu + hdd + mb + mac
Dim hwidEncrypted As String = Strings.UCase(hw.GetMD5Hash(cpu & hdd & mb & mac))
Dim SQL As String = String.Empty
SQL &= "SELECT * FROM HWID "
If Not String.IsNullOrEmpty(hwidEncrypted) Then
Dim UserData As DataTable = ExecuteSQL(SQL)
If SQL.Contains("hwidEncrypted") Then
Else
Close()
End If
End If |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| Module SQLSERVERCONNECTION
Public StringConnection As String = "Data Source=********;Initial Catalog=USERLOGINHWID;Integrated Security=True"
Function ExecuteSQL(sql As String) As DataTable
Try
Dim connection As New SqlConnection
Dim adapter As SqlDataAdapter
Dim dt As New DataTable
connection.ConnectionString = StringConnection
connection.Open()
adapter = New SqlDataAdapter(sql, connection)
adapter.Fill(dt)
connection.Close()
connection = Nothing
Return dt
Catch ex As Exception
' an erreur occured
End Try
End Function
End Module |
merci a vous