Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to connect C# with MySQL in 000webhost but it doesn't work.
My code:

What I have tried:

private void Form1_Load(object sender, EventArgs e)
{
try
{
connection = new MySqlConnection("Server=levukhanh270896.000webhostapp.com;Database=id5762970_car_parking;Uid=id5762970_khanhlevu;Pwd=123456;");
connection.Open();
if (connection.State == ConnectionState.Open)
{
label1.Text = "Connected";
label1.ForeColor = Color.Green;
}
else
{

label1.Text = "Not Connected";
label1.ForeColor = Color.Red;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Posted
Comments
Richard MacCutchan 25-May-18 4:03am    
"but it doesn't work."
What exactly is that supposed to mean?
Jinto Jacob 30-May-18 4:55am    
please be specific on what is the error. or what is not working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900