need some help im completely new to the database , i have made a server and a database now im trying to connect it with my c# code so that it verifies from the database before giving access to the main form, its giving this error : System.Data.SqlClient.SqlException: 'Incorrect syntax near 'tbl_LoginInfo'.'
my code:
private void Login_Button_Click(object sender, EventArgs e)
{
SqlConnection newconnect = new SqlConnection(@"Data Source=DESKTOP-3DH5S38\HR_SERVER;Initial Catalog=BMS_PRO_DB;Integrated Security=True");
string query = "Select * tbl_LoginInfo where Username = '" + UserName_Textbox.Text.Trim()+ "'and Password = "+Password_Textbox.Text.Trim();
SqlDataAdapter dataAdapter = new SqlDataAdapter(query, newconnect);
DataTable dataTable = new DataTable();
dataAdapter.Fill(dataTable);
if (dataTable.Rows.Count==1)
{
this.Hide();
MainForm mainForm = new MainForm();
mainForm.ShowDialog();
this.Close();
}
else
{
MessageBox.Show("Check Username/Password !");
}
}