Reputation: 1
I need to use a database in my xna 4.0 game that will save data such as username, etc. can you give me an example on how to connect to a MySQL database and as well as an insert statement. thank you !
Upvotes: 0
Views: 661
Reputation: 3415
Here is a walk through and wrapper class for mysql in c#. http://iseesharp.blogspot.com/2005/09/mysql-with-c.html
Usage:
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();
Upvotes: 1