Advertisement
Guest User

Untitled

a guest
Jul 9th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 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. namespace ACAPWatch_
  13. {
  14. public partial class Form1 : Form
  15. {
  16. public Form1()
  17. {
  18. InitializeComponent();
  19. }
  20.  
  21. //Registrieren&Anmelden Datenbank
  22. string connectionString = "datasource=127.0.0.1;port=3306;username=root;password=;database=test;";
  23.  
  24. //Bilder Server Connector
  25. string s_BildServer = "http://www.bilder-upload.eu/upload/";
  26.  
  27. private void button1_Click(object sender, EventArgs e)
  28. {
  29. //Top 12 Neuste Alben
  30. pbx_neu1.ImageLocation = s_BildServer + "3b154d-1499596685.jpg";
  31. pbx_neu2.ImageLocation = s_BildServer + "72a4fe-1499596839.jpg";
  32. pbx_neu3.ImageLocation = s_BildServer + "84f320-1499597070.jpg";
  33. pbx_neu4.ImageLocation = s_BildServer + "38e00b-1499597206.jpg";
  34. pbx_neu5.ImageLocation = s_BildServer + "07239e-1499597379.jpg";
  35. pbx_neu6.ImageLocation = s_BildServer + "fdff87-1499597612.jpg";
  36. pbx_neu7.ImageLocation = s_BildServer + "b0fbbd-1499597841.jpg";
  37. pbx_neu8.ImageLocation = s_BildServer + "2b710b-1499598218.jpg";
  38. pbx_neu9.ImageLocation = s_BildServer + "573aa7-1499598406.jpg";
  39. pbx_neu10.ImageLocation = s_BildServer + "4b0e99-1499598606.jpg";
  40. pbx_neu11.ImageLocation = s_BildServer + "6cb5af-1499598802.jpg";
  41. pbx_neu12.ImageLocation = s_BildServer + "4e7f7f-1499598978.jpg";
  42. }
  43.  
  44. private void btn_Registrieren_Click(object sender, EventArgs e)
  45. {
  46. {
  47. string query = "INSERT INTO user(`id`, `Benutzername`, `Passwort`) VALUES (NULL, '" + tbx_Benutzername.Text + "', '" + tbx_Passwort.Text + "')";
  48.  
  49. MySqlConnection databaseConnection = new MySqlConnection(connectionString);
  50. MySqlCommand commandDatabase = new MySqlCommand(query, databaseConnection);
  51. commandDatabase.CommandTimeout = 60;
  52.  
  53. try
  54. {
  55. databaseConnection.Open();
  56. MySqlDataReader myReader = commandDatabase.ExecuteReader();
  57.  
  58. MessageBox.Show("Du hast dich erfolgreich Registriert! Viel Spaß auf ACAPWatch!");
  59.  
  60. databaseConnection.Close();
  61. }
  62. catch (Exception ex)
  63. {
  64. // Show any error message.
  65. MessageBox.Show(ex.Message);
  66. }
  67. }
  68. }
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement