Try conn.ConnectionString = My.Settings.Database1ConnectionString conn.Open() cmd.Connection = conn cmd.CommandText = "SELECT passid FROM tblogin Where user=@user" cmd.Parameters.AddWithValue("@user", txtcod_ut.Text) passid = cmd.ExecuteScalar conn.Close() If suportelogin.GeraHash(txtpass.Text).Equals(passid) Then My.Forms.Página_Principal.ShowDialog() Me.Hide() Else MessageBox.Show("Erro!.", "Verifique de novo o código do utilizador e a palavra-passe", MessageBoxButtons.OK, MessageBoxIcon.Warning) 'focus- quando for precionado o botão "enter" do teclado, ele vai ativar esse controle como Ok txtpass.Focus() End If Catch ex As Exception MessageBox.Show("Erro ao efetuar a conexão com a base de dados :" + ex.Message) conn.Dispose() End Try
conn
Quote:conn.ConnectionString = My.Settings.Database1ConnectionString conn returns nothing
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)