如何在visual c# 2010中使用MySQL数据库

本文关键字:MySQL 数据库 2010 visual | 更新日期: 2023-09-27 18:16:04

我需要使用一个数据库在我的xna 4.0游戏,将保存数据,如用户名等,你可以给我一个例子如何连接到MySQL数据库,以及插入语句。谢谢你!

如何在visual c# 2010中使用MySQL数据库

下面是一个c#中mysql的包装类。http://iseesharp.blogspot.com/2005/09/mysql-with-c.html

用法:

DbWrapper myWrapper = new DbWrapper("localhost", "CS",
    "iseesharp", "seesharper");
myWrapper.Connect();
myWrapper.AddUser("Rowan", "ISeeSharp");
if (myWrapper.UserExists("rowan"))
{
    Console.WriteLine("Something's weird here");
}
else
    if (myWrapper.UserExists("Rowan"))
{
    Console.WriteLine("I exist, therefore I think!");
}
myWrapper.Disconnect();