Baglanti.FnkBaglan();
SqlCommand KayitSorgulaUsername = new SqlCommand("SELECT Username FROM User Where Username= @Username AND Username IS NOT NULL ", Baglanti.baglan);
SqlCommand KayitSorgulaMail = new SqlCommand("SELECT Mail FROM DatabaseProje.User Where Mail= @Mail AND Username IS NOT NULL ", Baglanti.baglan);
KayitSorgulaUsername.Parameters.AddWithValue("@Username", TxtUyeOlUsername.Text);
KayitSorgulaMail.Parameters.AddWithValue("@Mail", TxtUyeOlMail.Text);
SqlDataReader VeriOkuUsername = KayitSorgulaUsername.ExecuteReader();
SqlDataReader VeriOkuMail = KayitSorgulaMail.ExecuteReader();
System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'User'.
This error appears after I entered the values to textboxes. How can I fix this error?
User is a reserved word in sql so use it with square brackets, so that it is considered as table name:
SELECT Username FROM [User]