How to connect to a database mariadb Network by C# Windows & Linux



How to connect to a database mariadb Network by C# Windows & Linux

How to connect to a database mariadb Network by C# Windows & Linux

How to connect to a database mariadb Network by C# Windows & Linux Inside and outside the network

using MySql.Data.MySqlClient;

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace str
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
MySql.Data.MySqlClient.MySqlConnection connect;
string MyconnetString;
MyconnetString = “server=” + textBox1.Text + “;port=” + textBox2.Text + “;Database=” + textBox3.Text + “;uid=” + textBox4.Text + “;pwd=” + textBox5.Text +”; “;

try
{

connect = new MySql.Data.MySqlClient.MySqlConnection();
connect.ConnectionString = MyconnetString;
connect.Open();
if (connect .State == ConnectionState.Open )
{
button1.ForeColor = Color.Green;
MessageBox.Show(“Good”);
}
connect.Close();

// Thank all ):

}
catch (MySql.Data.MySqlClient.MySqlException ex)
{

MessageBox.Show(ex.Message );
}

}
}
}

https://www.proands.com/

Comments are closed.