本文介绍了VB.NET MySQL连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Visual Studio可以本地连接到MySQL数据库吗?还是我需要首先安装第三方连接器?有人可以以任何一种方式提供一个小的代码示例吗?我似乎无法完成这项工作.
Can Visual Studio natively connect to a MySQL database or do I need to install a 3rd party connector first? Could someone please provide a small code example either way? I can't seem to make this work.
推荐答案
根据我的知识,不会.
Based upon my knowledge, no.
在这里,我找到了这个例子:
In there, I found this example:
Imports System.Data
Imports MySql.Data
Imports MySql.Data.MySqlClient
Public Class Tutorial1
Public Shared Sub Main()
Dim connStr As String = "server=localhost;user=root;database=world;port=3306;password=******;"
Dim conn As New MySqlConnection(connStr)
Try
Console.WriteLine("Connecting to MySQL...")
conn.Open()
Catch ex As Exception
Console.WriteLine(ex.ToString())
End Try
conn.Close()
Console.WriteLine("Done.")
End Sub
End Class
这篇关于VB.NET MySQL连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!