Login system
Hi im trying to make a login form with user name and password, I opened a sql database server using this website freesqldatabase.com, I connected it to phpmyadmin, created tables... then I connected the visual studio into the server.
I always get this error: "MySql.Data.MySqlClient.MySqlException: 'Authentication to host 'sql2.freesqldatabase.com' for user 'sql2288856' using method 'mysql_native_password' failed with message: Access denied for user 'sql2288856'@'bzq-21-168-31-250.red.bezeqint.net' (using password: NO)'.
And this is my source code:
I always get this error: "MySql.Data.MySqlClient.MySqlException: 'Authentication to host 'sql2.freesqldatabase.com' for user 'sql2288856' using method 'mysql_native_password' failed with message: Access denied for user 'sql2288856'@'bzq-21-168-31-250.red.bezeqint.net' (using password: NO)'.
And this is my source code:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using System.Windows.Forms.VisualStyles;
namespace Login
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void monoFlat_ThemeContainer1_Click(object sender, EventArgs e)
{
}
private void btnLogin_Click(object sender, EventArgs e)
{
string user = textUser.Text;
string pass = textPass.Text;
MySqlConnection conn = new MySqlConnection("server=sql2.freesqldatabase.com;user id=sql2288856;database=sql2288856");
MySqlDataAdapter sda = new MySqlDataAdapter("SELECT * FROM `mylogin` where username='" + textUser.Text + "' and password='" + textPass.Text + "'", conn);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows[0][0].ToString() == "1")
{
MessageBox.Show("Logged in!");
}
else
{
MessageBox.Show("incorrect username or pass");
}
}
}
}
