Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.90 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using MySql.Data;
  6. using MySql.Data.MySqlClient;
  7. using System.Data.SqlClient;
  8. using System.Data;
  9. using System.Collections;
  10. using System.Threading;
  11.  
  12. namespace accounts
  13. {
  14.     class Program
  15.     {
  16.         static void Main(string[] args)
  17.         {
  18.  
  19.  
  20.  
  21.             while (true)
  22.             {
  23.  
  24.                 string MyConString = "SERVER=localhost;" +
  25.                    "DATABASE=emulator;" +
  26.                    "UID=root;" +
  27.                    "PASSWORD=;";
  28.                 MySqlConnection connection = new MySqlConnection(MyConString);
  29.                 MySqlCommand command = connection.CreateCommand();
  30.                 MySqlDataReader Reader;
  31.                 command.CommandText = "SELECT id,password,mail FROM users";
  32.                 Console.WriteLine("Accountok keresése..");
  33.                 string MsConString = "Data source=.\\SQLEXPRESS;Database=silkroad;User=sa;Password=1234;";
  34.                 SqlConnection connection2 = new SqlConnection(MsConString);
  35.                 SqlCommand command2 = connection2.CreateCommand();
  36.                 connection.Open();
  37.                 Reader = command.ExecuteReader();
  38.                 while (Reader.Read())
  39.                 {
  40.  
  41.                     connection2.Open();
  42.                     string id = Reader["id"].ToString();
  43.                     string pw = Reader["password"].ToString();
  44.                     command2.CommandText = ("INSERT INTO users (id,password) VALUES ('" + id + "','" + pw + "')");
  45.                     command2.ExecuteReader();
  46.                     connection2.Close();
  47.                     Console.WriteLine("Új account az adatbázisban!");
  48.                     Console.WriteLine("Újra ellenőrzés hamarosan...");
  49.                 }
  50.                 connection.Close();
  51.                 Thread.Sleep(10000);
  52.             }
  53.             }
  54.        
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement