Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 MySql.Data.MySqlClient;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- // String dbconnect = "Server=129.241.151.172;Database=IT1901;User=root;Password='herp'";
- //MySqlConnection dbconn = new MySqlConnection(dbconnect);
- //dbconn.Open();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void tabPage3_Click(object sender, EventArgs e)
- {
- }
- private void label2_Click(object sender, EventArgs e)
- {
- }
- private void label11_Click(object sender, EventArgs e)
- {
- }
- private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
- {
- }
- private void labelNyPassord_Click(object sender, EventArgs e)
- {
- }
- private void textEpost_TextChanged(object sender, EventArgs e)
- {
- }
- private void buttonLagreEndringer_Click(object sender, EventArgs e)
- {
- // string epost = textBoxEpost.Text;
- // string oldpw = textBoxGammelPassord.Text;
- // string newpw = textBoxNyPassord.Text;
- //int epost = 43;
- //int newpw = 1234;
- //string oldpw = "Drammen";
- String dbconnect = "Server=129.241.151.172;Database=IT1901;User=root;Password=herp";
- MySqlConnection dbconn = new MySqlConnection(dbconnect);
- MySqlCommand cmd = dbconn.CreateCommand();
- cmd.CommandText = "INSERT INTO Kommune (kommuneID, kommunenavn, nummer) VALUES(@kommuneID, @kommunenavn, @nummer)";
- cmd.Parameters.AddWithValue("@kommunenavn", textBoxEpost.Text);
- cmd.Parameters.AddWithValue("@nummer", textBoxNyPassord.Text);
- cmd.Parameters.AddWithValue("@kommuneID", textBoxGammelPassord.Text);
- dbconn.Open();
- cmd.ExecuteNonQuery();
- dbconn.Close();
- MessageBox.Show("Lagret");
- }
- }
- }
Add Comment
Please, Sign In to add comment