Hello,
Im trying to do a simple application to send and read variables in the/to My DataBase.
Myy code:
Problem it always say:
Why this appens?
Im trying to do a simple application to send and read variables in the/to My DataBase.
Myy code:
PHP:
Imports MySql.Data.MySqlClientPublic Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim conn As MySqlConnection conn = New MySqlConnection conn.ConnectionString = "Server=*****;User Id=******;Password=*****;Database=******" Try conn.Open() Catch ex As Exception MsgBox(ex.Message) End Try Dim myadapter As New MySqlDataAdapter Dim sqlquery = "SELECT * FROM account WHERE fname='" & TextBox1.Text & "' AND lname='" & TextBox2.Text & "'" Dim mycommand As New MySqlCommand mycommand.Connection = conn mycommand.CommandText = sqlquery myadapter.SelectCommand = mycommand Dim mydata As MySqlDataReader mydata = mycommand.ExecuteReader If mydata.HasRows = 0 Then MsgBox("Bad") Else MsgBox("Good") Me.Hide() End If End SubEnd Class
Problem it always say:
VB.NET:
Unable to connect to any of the specified MsSQL hosts.
Why this appens?