38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using MySql.Data.MySqlClient;
|
|
using MySqlX.XDevAPI.Relational;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Runtime.Remoting.Messaging;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ISPr_410_Rubinova
|
|
{
|
|
internal class Class1
|
|
{
|
|
MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();
|
|
builder.Server = "80.90.179.235";
|
|
builder.Port = 3306;
|
|
builder.Database = "ISPr_410_Rubinova";
|
|
builder.UserID = "ISPr_410";
|
|
builder.Password = "ISPr_410";
|
|
MySqlConnection connect = new MySqlConnection(builder.ConnectionString);
|
|
try
|
|
{
|
|
connect.Open();
|
|
MySqlCommand command = new MySqlCommand(sql, connect);
|
|
MySqlDataReader reader = command.ExecuteReader();
|
|
DataTable table = new DataTable();
|
|
table.Load(reader);
|
|
return table;
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
MessageBox.Show("При выполнении запроса возникла ошибка" + e.Message);
|
|
return null;
|
|
}
|
|
}
|
|
}
|