public void InsertRow(string myConnectionString)
{
// If the connection string is empty, use default.
if(myConnectionString == "")
{
myConnectionString =
"User Id=root;Host=localhost;Database=Test;";
}
MySqlConnection myConn = new MySqlConnection(myConnectionString);
string myInsertQuery = "INSERT INTO DEPT VALUES (50,'Development','Philadelphia')";
MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
myCommand.Connection = myConn;
myConn.Open();
try
{
myCommand.ExecuteNonQuery();
}
finally
{
myConn.Close();
}
}