COmo Hacer un Login en C# usando Access? Hola soy un novato super novato, quisiera saver si podrian ayduarme con el Login!!!
este es el code que tengo pero lo hice con vb.net como lo hago en C#?
gracias.
Protected Sub button1_click(sender As Object, e As AuthenticateEventArgs)
Dim Authenticated As Boolean = false
Dim strConnection As String = "server=mexhernanm1; database=SAPonline; uid=melissa; pwd=israel;"
Dim Connection As New SqlConnection(strConnection)
Dim strSQL As String = "Select username,password From Users"
Dim command As New SqlCommand(strSQL, Connection)
Connection.Open()
Dim Dr As SqlDataReader = command.ExecuteReader()
While Dr.Read()
If (txtUserName.TextBox = Dr("username").ToString()) And (txtPassword.TextBox = Dr("Password").ToString()) Then
Authenticated = true
End if
End While
Dr.Close()
If Authenticated = true Then
'Entrar
MainForm.Show()
Else
'No Entrar
MessageBox.Show("Incorrecto","Titulo",MessageBoxBu ttons.OK)
End if
Connection.Close()
End Sub |