Guest User

Untitled

a guest
Dec 9th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using MySql.Data.MySqlClient;
  11.  
  12.  
  13. namespace WindowsFormsApplication1
  14. {
  15. public partial class Form1 : Form
  16. {
  17. public Form1()
  18. {
  19. InitializeComponent();
  20. // String dbconnect = "Server=129.241.151.172;Database=IT1901;User=root;Password='herp'";
  21. //MySqlConnection dbconn = new MySqlConnection(dbconnect);
  22. //dbconn.Open();
  23. }
  24.  
  25. private void Form1_Load(object sender, EventArgs e)
  26. {
  27.  
  28. }
  29.  
  30. private void label1_Click(object sender, EventArgs e)
  31. {
  32.  
  33. }
  34.  
  35. private void tabPage3_Click(object sender, EventArgs e)
  36. {
  37.  
  38. }
  39.  
  40. private void label2_Click(object sender, EventArgs e)
  41. {
  42.  
  43. }
  44.  
  45. private void label11_Click(object sender, EventArgs e)
  46. {
  47.  
  48. }
  49.  
  50. private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
  51. {
  52.  
  53. }
  54.  
  55. private void labelNyPassord_Click(object sender, EventArgs e)
  56. {
  57.  
  58. }
  59.  
  60. private void textEpost_TextChanged(object sender, EventArgs e)
  61. {
  62.  
  63. }
  64.  
  65. private void buttonLagreEndringer_Click(object sender, EventArgs e)
  66. {
  67.  
  68. // string epost = textBoxEpost.Text;
  69. // string oldpw = textBoxGammelPassord.Text;
  70. // string newpw = textBoxNyPassord.Text;
  71. //int epost = 43;
  72. //int newpw = 1234;
  73. //string oldpw = "Drammen";
  74.  
  75. String dbconnect = "Server=129.241.151.172;Database=IT1901;User=root;Password=herp";
  76. MySqlConnection dbconn = new MySqlConnection(dbconnect);
  77. MySqlCommand cmd = dbconn.CreateCommand();
  78.  
  79.  
  80. cmd.CommandText = "INSERT INTO Kommune (kommuneID, kommunenavn, nummer) VALUES(@kommuneID, @kommunenavn, @nummer)";
  81.  
  82. cmd.Parameters.AddWithValue("@kommunenavn", textBoxEpost.Text);
  83. cmd.Parameters.AddWithValue("@nummer", textBoxNyPassord.Text);
  84. cmd.Parameters.AddWithValue("@kommuneID", textBoxGammelPassord.Text);
  85.  
  86. dbconn.Open();
  87. cmd.ExecuteNonQuery();
  88. dbconn.Close();
  89. MessageBox.Show("Lagret");
  90.  
  91. }
  92.  
  93.  
  94. }
  95. }
Add Comment
Please, Sign In to add comment