===== C Sharp - MySQL Connector ===== using MySql.Data.MySqlClient; . . . string myConnectionString = "Database=" + bazaDanych + ";Data Source=" + host + ";User Id=" + login + ";Password=" + pass + ";CharSet=" + kodowanie; MySqlConnection myConnection = new MySqlConnection(myConnectionString); try { string mySelectQuery = "SELECT * FROM tabela"; MySqlCommand myCommand = new MySqlCommand(mySelectQuery); myCommand.Connection = myConnection; myConnection.Open(); MySqlDataReader myReader; myReader = myCommand.ExecuteReader(); string[] row = new string[5]; i = 1; while (myReader.Read()) { row[0] = i.ToString(); row[1] = myReader.GetString(0); row[2] = myReader.GetString(2); row[3] = myReader.GetString(3); row[4] = myReader.GetString(1); naszDataGrid.Rows.Add(row); i++; } myCommand.Connection.Close(); . . . MySqlConnection myConnection = new MySqlConnection(myConnectionString); try { string myInsertQuery = "INSERT INTO `tabela` (nazwa) Values(?nazwa)"; MySqlCommand myCommand = new MySqlCommand(myInsertQuery); myCommand.Connection = myConnection; myConnection.Open(); myCommand.Parameters.AddWithValue("?nazwa", nazwa.Text); myCommand.ExecuteNonQuery(); myCommand.Connection.Close(); } catch (Exception ee) { MessageBox.Show("Problem z połączeniem do bazy danych: " + ee.ToString()); } finally { myConnection.Close(); this.Close(); }