C#调用MySql
时间:2021-07-01 10:21:17
帮助过:23人阅读
System;
using System.Collections;
using System.Configuration;
using MySql.Data;
using MySql.Data.MySqlClient;
using System.Data;
namespace Sql
//数据库简单测试
{
class InsertSql1
{
public static void Main(
string[] args)
{
string constr=
"server=localhost;User Id=root;password=219229;Database=reg";
MySqlConnection mycon=
new MySqlConnection(constr);
mycon.Open();
MySqlCommand mycmd =
new MySqlCommand(
"insert into buyer(name,password,email) values(‘小王‘,‘dikd3939‘,‘1134384387@qq.com‘)",mycon);
if (mycmd.ExecuteNonQuery()>
0)
{
Console.WriteLine("数据插入成功!");
}
Console.ReadLine();
mycon.Close();
}
}
}
C#调用MySql
标签:windows ring sql root art 将不 roo email source