Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27472

Connect to mysql

$
0
0
Hi everyone, i would really need som help please, i have programed in Visul basic 2010 a login system, i have made everything in phpmyadmin etc and whene i try to connect to the server i just get that Unable to connect to any of the specified MySQL hosts. Can anyone help me pleas and locate the problem?

here is the whole code

Imports System.Data.SqlClient
Imports MySql.Data.MySqlClient
Public Class LoginForm1
Dim mysqlconnection As MySqlConnection



Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
mysqlconnection = New MySqlConnection
mysqlconnection.ConnectionString = "server=remote-mysql3.servage.net;Port=3306; user id=fifaligan; password=xxxxx; database=fifaligan
mysqlconnection.Open()





Dim myadapter As New MySqlDataAdapter
Dim sqlquary = "SELECT * From Users WHERE Username='" & UsernameTextBox.Text & "'AND Password='" & PasswordTextBox.Text & "';"
Dim command As New MySqlCommand
command.Connection = mysqlconnection
command.CommandText = sqlquary
myadapter.SelectCommand = command
Dim mydata As MySqlDataReader
mydata = command.ExecuteReader
If mydata.HasRows = 0 Then
MsgBox("Fel inloggnings information")
Else
Form10.Show()
Me.Close()
End If
End Sub

Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
Me.Close()
End Sub

End Class

Viewing all articles
Browse latest Browse all 27472

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>