前期准备
安装MySql.Data 包
配置外部文件
<connectionStrings>
<add name="connStr"
connectionString="server=localhost;database=mysql_student;uid=root;pwd=123456"
providerName="MySql.Data.MySqlClient"/>
</connectionStrings>
一、MysqlCommand 不带参数
MySqlCommand cmd = connect.CreateCommand();
cmd.CommandText = sql;
cmd.Connection = connect;
internal class Program
{
static void Main(string[] args)
{
//获取外部文件字符串
string connStr = ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
using (MySqlConnection connect = new