Ich habe hier auch einen fehler dennn ich ned behoben bekomme -.-
sobalt ich denn "start" Button drücke kommt der fehler
"Unable to connect to any of the specified MySQL hosts.
So sieht meine database aus
sobalt ich denn "start" Button drücke kommt der fehler
"Unable to connect to any of the specified MySQL hosts.
So sieht meine database aus
VB.NET-Quellcode
- Imports MySql
- Imports MySql.Data
- Imports MySql.Data.MySqlClient
- Public Class Form1
- Dim cn As New MySqlConnection
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Try
- Dim con As New MySqlConnection("server=127.0.0.1:3306; userid=root; password=root; database=test;")
- Try
- con.Open()
- MessageBox.Show("mysql open")
- Catch ex As MySqlException
- MessageBox.Show(ex.Message)
- End Try
- Dim command As New MySqlCommand("select * FROM shutdown where MacId = @MacId", con)
- command.Parameters.Add("@MacId", SqlDbType.VarChar).Value = TextBox1.Text
- Dim adapter As New MySqlDataAdapter(command)
- Dim table As New DataTable
- adapter.Fill(table)
- TextBox2.Text = table.Rows(0)(1).ToString()
- TextBox3.Text = table.Rows(0)(2).ToString()
- TextBox4.Text = table.Rows(0)(3).ToString()
- 'Button1.Enabled = False
- Catch ex As MySql.Data.MySqlClient.MySqlException
- MessageBox.Show(ex.Message)
- End Try
- End Sub
- Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
- End Sub
- End Class