connecstring ข้าม host ค่ะ แต่กลับเออเรอร์ unable to connect to any of the specified mysql hosts ทำไงดีค่ะ ใช้ mysql กับ asp.net
Code (VB.NET)
Imports System.Data
Imports MySql.Data.MySqlClient
Public Class GIS_RoutestationMin
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim connectionString As String = "Server=......;Port=1234;Database=......;Uid=.....;Pwd=............;"
Dim connection As New MySqlConnection(connectionString)
If connection.State.Equals(ConnectionState.Closed) Then
connection.Open()
End If
Dim QueryString As New StringBuilder()
QueryString.Append("SELECT routestation.subrouteid,isgo,seqid)
QueryString.Append(" FROM routestation ")
QueryString.Append(" GROUP BY routestation.subrouteid, isgo")
Response.Write(QueryString.ToString())
Dim OracleAdapter As New MySqlDataAdapter(QueryString.ToString(), connection)
Dim DataTable As New DataTable("TestTable")
OracleAdapter.Fill(DataTable)
GridView1.DataSource = DataTable
GridView1.DataBind()
GridView1.Visible = True
Response.Write(DataTable.Rows.Count.ToString())
End Sub
End Class
Authentication to host '192.168.1.111' for user 'root' using method 'mysql_native_password' failed with message: Access denied for user 'root'@'192.168.1.22' (using password: YES)
Dim connectionString As String = "Server=192.168.1.111;Port=3306;Database=jaja;Uid=root;Pwd=xxx;"
Dim connection As New MySqlConnection(connectionString)
If connection.State.Equals(ConnectionState.Closed) Then
connection.Open()
End If