Thank you so much for the knowledge you have poured. But I have a question for you, there is no error but why if I press the Login button, the message box issues "Failed to connect to database .."? even though I've added the source already. Please state your help if you don't mind. Thanks again. :)
Maybe I failed to connect to database is because my Dim sql As String is not follow my actually table name. I have no error this time. Thank you for your sharing. Have a nice day Sir. :)
Imports System.Data.OleDb Public Class Form1 Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\176\Desktop\login.mdb;" Dim query As String = "SELECT * FROM Users WHERE Username=@Username AND Password=@Password" Using connection As New OleDbConnection(connectionString) Dim command As New OleDbCommand(query, connection) command.Parameters.AddWithValue("@Username", txtUsername.Text) command.Parameters.AddWithValue("@Password", txtPassword.Text) connection.Open() Dim reader As OleDbDataReader = command.ExecuteReader() If reader.Read() Then MessageBox.Show("Login successful!") Me.Hide() Form2.Show() Else MessageBox.Show("Invalid username or password.") End If reader.Close() connection.Close() End Using End Sub End Class
Pano naman pag mag create ng account na maaadd sya ng kusa sa msaccess db?
Bakit po failed to connect to database lang lumalabas?
unsa naa sa form2 nimo nikalit man gud ka ug lukso
then pag log in nako admin dili man marecord sa microsoft access username ug password walay records
Hello po, pwede humingi ng installer sa MS Access 2010 Database?
panp gagawin pag failed to connect to database
na tru mona ba amg review sa codeS?
bakit my error ako sa form2.show()
Hi pano pag ang lumalabas ay "failed to connect to database" ? Saan ang problem po?
Hi, have you found the solution?
Hi po. Pwede po ba mahingi kung saan po kayo nag download ng ms access 2010?
FAILED TO CONNECT TO DATABASE bat ganyan lumalabas paps? Please pa help naman, di ko nakikita ang mali eh
Hi sir pwed po ako magpa program ng legal document system
inbox me sir, Whatsapp #09306247025
Thank you so much for the knowledge you have poured. But I have a question for you, there is no error but why if I press the Login button, the message box issues "Failed to connect to database .."? even though I've added the source already. Please state your help if you don't mind. Thanks again. :)
Maybe I failed to connect to database is because my Dim sql As String is not follow my actually table name. I have no error this time. Thank you for your sharing. Have a nice day Sir. :)
how?
nag failed to connect database pa rin sakin
Hello po. Sinunod ko naman po lahat pero database connection error parin. Pa help po
Hi, have you found the solution?
failed to connect to database pa rin
Failed to connect data base always occurring
Hi, have you found the solution?
Sir, waray ka?
bisaya sir
0:47 Hello po sir new subscriber po, pwede po makita dito paano nyo po ginawa yung ordering system?
Username and password do not match po
pwedeng makahingi ng installer lods??
PAPS "FAILED TO CONNECT TO DATABASE" bkt po ganun
Hi, have you found the solution?
Imports System.Data.OleDb
Public Class Form1
Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\176\Desktop\login.mdb;"
Dim query As String = "SELECT * FROM Users WHERE Username=@Username AND Password=@Password"
Using connection As New OleDbConnection(connectionString)
Dim command As New OleDbCommand(query, connection)
command.Parameters.AddWithValue("@Username", txtUsername.Text)
command.Parameters.AddWithValue("@Password", txtPassword.Text)
connection.Open()
Dim reader As OleDbDataReader = command.ExecuteReader()
If reader.Read() Then
MessageBox.Show("Login successful!")
Me.Hide()
Form2.Show()
Else
MessageBox.Show("Invalid username or password.")
End If
reader.Close()
connection.Close()
End Using
End Sub
End Class