ConnectionString for MySQL w VB.NET For now I’ve only tested it on local server – it works. I hope it will work with external server.
Attention! This post has been published on my old website that has been down. I’m archiving old not verified posts for possible future use. Please be careful when using this post content.
ConnectionString for MySQL works when add these references to projects:
I’ve known to add MySql.Data reference, but to add MySql.Web
O tym, że trzeba dodać MySql.Data wiedziałem, ale że MySql.Web I’ve learned from this site:
Creating ConnectionString from MySQL in VB.NET and open connection. In order to connect MySQL located on external server MySQL user setting could be changed. Please read this post: Remote connection to MySQL.
Imports MySql.Data.MySqlClient Imports System.Data Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Dim conn As MySqlConnection = New MySqlConnection() conn.ConnectionString = "Data Source=Localhost; Database=DB_name; Uid=UserName; Pwd=Pass;" Dim dt As New DataTable Try conn.Open() Catch ex As Exception MsgBox (ex.Message) End Try End Sub End Class