Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using MySql.Data.MySqlClient;
- using System.IO;
- using System.Data;
- using System.Collections.Generic;
- namespace ConsoleApplication2
- {
- class Program
- {
- const string connectionInfo = ("host=localhost;" + "port = '3306';" + "database='mangos';" + "UserName='root';" + "Password='mangos'");
- public static StreamWriter Log = new StreamWriter("sql_log.txt", true);
- public static bool bconnection { get; private set; }
- public static bool bcompare { get; private set; }
- public static MySqlCommand fcommand;
- public static MySqlCommand scommand;
- static void Main(string[] args)
- {
- Console.WriteLine("--------------------Programm is open!--------------------");
- ToLog("Programm is open!");
- TryCon();
- if (!bconnection)
- {
- Console.WriteLine("-------------Check your MySQL server-------------");
- Console.WriteLine("-------------Press any key for exit-------------");
- ToLog("MySQL Server not running");
- Console.ReadKey(true);
- return;
- }
- else
- {
- MySqlConnection connect = new MySqlConnection(connectionInfo);
- connect.Open();
- Console.WriteLine("-------------Connection open-------------");
- ToLog("Connection open");
- Console.WriteLine("Start compare?");
- string variant = Console.ReadLine();
- if (variant == "y" || variant == "Y")
- {
- Console.WriteLine("start compare....");
- ToLog("Start compare.....");
- bcompare = true;
- }
- else if (variant == "n" || variant == "N")
- {
- Console.WriteLine("Press any key for exit");
- connect.Close();
- bcompare = false;
- }
- else
- Console.WriteLine("Neee press 'y' or 'n'");
- if (bcompare)
- {
- string fSelect = "SELECT * FROM world.creature_template";
- string sSelect = "SELECT * FROM world.creature_template_cache";
- fcommand = new MySqlCommand(fSelect, connect);
- scommand = new MySqlCommand(sSelect, connect);
- var fDBstructur = fcommand.ExecuteReader();
- var sDBstructur = scommand.ExecuteReader();
- while (fDBstructur.Read())
- {
- }
- }
- }
- Console.ReadKey();
- }
- public static void ToLog(string text)
- {
- Log.WriteLine(DateTime.Now.ToString("[HH:mm:ss]") + text); Log.Flush();
- }
- public static void TryCon()
- {
- try
- {
- MySqlConnection connect = new MySqlConnection(connectionInfo);
- connect.Open();
- connect.Close();
- bconnection = true;
- }
- catch
- {
- bconnection = false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement