33 lines
928 B
C#
33 lines
928 B
C#
using System.Net;
|
|
using MySql.Data.MySqlClient;
|
|
|
|
namespace Server
|
|
{
|
|
public class Reset : Route
|
|
{
|
|
public static void HandleRequest(HttpListenerRequest request, HttpListenerResponse response)
|
|
{
|
|
try
|
|
{
|
|
// prepare SQL query
|
|
MySqlCommand cmd = new MySqlCommand();
|
|
cmd.CommandText = "CALL InitDB";
|
|
using (MySqlConnection conn = new MySqlConnection(connectionString))
|
|
{
|
|
cmd.Connection = conn;
|
|
// open connection
|
|
conn.Open();
|
|
// execute query
|
|
cmd.ExecuteNonQuery();
|
|
// set up and send response
|
|
SendSuccess(response);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SendError(response, ex);
|
|
}
|
|
}
|
|
}
|
|
}
|