eu tenho um sistema de login com os seguintes campos na tabela mysql
Username - Password - Hwid
nick - pass -
ao fazer login com o usuário nick eu preciso verificar o que está cadastrado em hwid e caso n exista nada o programa deve cadastrar,
e caso esteja cadastrado algum valor o programa verifica se é igual ao do computador.
onde está o erro ?, basicamente eu preciso ler se for o caso atualizar e ler novamente para comparar os dados
Dim Hwid As New clsComputerInfo
Dim Cpu As String
Dim Lan As String
Dim Mobo As String
Dim HD As String
Cpu = Hwid.GetProcessorId
Lan = Hwid.GetMACAddress
Mobo = Hwid.GetMotherBoardID
HD = Hwid.GetVolumeSerial
Dim Key As String = (Cpu & Lan & Mobo & HD)
ObjConn.ConnectionString = "server=localhost;" & "user id=Myuser;" & "password=Mypass;" & "database=Myuser;"
Try
ObjConn.Open()
Catch ex As Exception
InfluenceTextBox1.Enabled = True
InfluenceTextBox2.Enabled = True
End Try
StrSql = "select UserName, Password, HWID from cadastro where UserName=@field1 and Password=@field2"
ObjCmd = New MySql.Data.MySqlClient.MySqlCommand(StrSql, ObjConn)
With ObjCmd
.Parameters.AddWithValue("@field1", InfluenceTextBox1.Text)
.Parameters.AddWithValue("@field2", InfluenceTextBox2.Text)
End With
ObjCmd.ExecuteNonQuery()
ObjDr = ObjCmd.ExecuteReader
If (ObjDr.Read()) Then
If ObjDr.GetString("HWID") = "" Then
StrSqlNew = "UPDATE vip SET HWID=@field where UserName=@field1 and Password=@field2"
ObjCmdNew = New MySql.Data.MySqlClient.MySqlCommand(StrSqlNew, ObjConn)
With ObjCmdNew
.Parameters.AddWithValue("@field", Key)
.Parameters.AddWithValue("@field1", InfluenceTextBox1.Text)
.Parameters.AddWithValue("@field2", InfluenceTextBox2.Text)
End With
ObjCmdNew.Dispose()
End If
if ObjDr.GetString("HWID") = Key Then
MsgBox("Hwid Confirmado", MsgBoxStyle.Critical)
else
MsgBox("Hwid Diferente", MsgBoxStyle.Critical)
End If
End If
Pergunta
Read
eu tenho um sistema de login com os seguintes campos na tabela mysql
ao fazer login com o usuário nick eu preciso verificar o que está cadastrado em hwid e caso n exista nada o programa deve cadastrar,
e caso esteja cadastrado algum valor o programa verifica se é igual ao do computador.
onde está o erro ?, basicamente eu preciso ler se for o caso atualizar e ler novamente para comparar os dados
Dim Hwid As New clsComputerInfo Dim Cpu As String Dim Lan As String Dim Mobo As String Dim HD As String Cpu = Hwid.GetProcessorId Lan = Hwid.GetMACAddress Mobo = Hwid.GetMotherBoardID HD = Hwid.GetVolumeSerial Dim Key As String = (Cpu & Lan & Mobo & HD) ObjConn.ConnectionString = "server=localhost;" & "user id=Myuser;" & "password=Mypass;" & "database=Myuser;" Try ObjConn.Open() Catch ex As Exception InfluenceTextBox1.Enabled = True InfluenceTextBox2.Enabled = True End Try StrSql = "select UserName, Password, HWID from cadastro where UserName=@field1 and Password=@field2" ObjCmd = New MySql.Data.MySqlClient.MySqlCommand(StrSql, ObjConn) With ObjCmd .Parameters.AddWithValue("@field1", InfluenceTextBox1.Text) .Parameters.AddWithValue("@field2", InfluenceTextBox2.Text) End With ObjCmd.ExecuteNonQuery() ObjDr = ObjCmd.ExecuteReader If (ObjDr.Read()) Then If ObjDr.GetString("HWID") = "" Then StrSqlNew = "UPDATE vip SET HWID=@field where UserName=@field1 and Password=@field2" ObjCmdNew = New MySql.Data.MySqlClient.MySqlCommand(StrSqlNew, ObjConn) With ObjCmdNew .Parameters.AddWithValue("@field", Key) .Parameters.AddWithValue("@field1", InfluenceTextBox1.Text) .Parameters.AddWithValue("@field2", InfluenceTextBox2.Text) End With ObjCmdNew.Dispose() End If if ObjDr.GetString("HWID") = Key Then MsgBox("Hwid Confirmado", MsgBoxStyle.Critical) else MsgBox("Hwid Diferente", MsgBoxStyle.Critical) End If End IfLink para o comentário
Compartilhar em outros sites
2 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.