Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using MetroFramework.Forms;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Data.SqlClient;
- using System.Threading;
- using MySql.Data.MySqlClient;
- using MetroFramework;
- namespace FLPI_Admin_Tools
- {
- public partial class Panel : MetroForm
- {
- MySqlCommandBuilder cmbl;
- private MySqlDataAdapter sdaHFP;
- private DataTable table;
- MySqlConnection cn;
- public Panel()
- {
- InitializeComponent();
- }
- private void Panel_Load(object sender, EventArgs e)
- {
- var command = "SELECT * FROM players";
- var connection = @"datasource=localhost;port=3306;database=dp_frost;username=root;password=;SslMode=none";
- table = new DataTable();
- sdaHFP = new MySqlDataAdapter(command, connection);
- var commandBuilder = new MySqlCommandBuilder(sdaHFP);
- foreach (DataRow item in table.Rows)
- {
- int n = metroGrid1.Rows.Add();
- metroGrid1.Rows[n].Cells[0].Value = item["ID"].ToString();
- metroGrid1.Rows[n].Cells[1].Value = item["UID"].ToString();
- metroGrid1.Rows[n].Cells[2].Value = item["NAME"].ToString();
- metroGrid1.Rows[n].Cells[3].Value = item["FACTION"].ToString();
- }
- this.metroGrid1.DataSource = table;
- }
- private void btnUpdate_Click(object sender, EventArgs e)
- {
- this.metroGrid1.EndEdit();
- sdaHFP.Update(table);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement