incorrect syntax near the keyword "WHERE
public static Boolean AddTodo(string name, string email, string password) { Boolean c = false; try { SqlConnection connection = new SqlConnection(); connection.ConnectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Documents\WinDB.mdf;Connect Timeout=30;User Instance=True;Integrated Security=SSPI"; connection.Open(); SqlCommand command1 = new SqlCommand("SELECT * FROM UserInfo. WHERE UserName= @UserName", connection); command1.Parameters.Add(new SqlParameter("@UserName", name)); command1.ExecuteNonQuery(); SqlDataReader reader = command1.ExecuteReader(); { if (!reader.HasRows) { reader.Close(); SqlCommand command = new SqlCommand("insert into UserInfo. (UserName, UserEmail, Password) values (@UserName, @UserEmail, @Password)", connection); command.Parameters.Add(new SqlParameter("@UserName", name)); command.Parameters.Add(new SqlParameter("@UserEmail", email)); command.Parameters.Add(new SqlParameter("@Password", password)); command.ExecuteNonQuery(); c = true; } else { MessageBox.Show("UserName is thaken"); } } connection.Close(); } catch (SqlException e) { MessageBox.Show(e.Message); } return c ; }
SqlCommand command1 = new SqlCommand("SELECT * FROM UserInfo. WHERE UserName= @UserName", connection);
SqlCommand command1 = new SqlCommand("SELECT * FROM UserInfo WHERE UserName= @UserName", connection);
new SqlCommand("SELECT * FROM UserInfo.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)