I'm getting this error:
Invalid object name 'Members'
on this line:
int MemberExist = (int)check_Member.ExecuteScalar();
With my current DB which looks like this: http://imgur.com/6fyKGn3 Why wouldn't this be executing?
Code:
// Get the connection
SqlConnection DBConnection = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=""E:\DS\Prac5\Part1\App_Data\MyDatabase.mdf"";Integrated Security=True");
SqlDataReader Reader = null;
DBConnection.Open();
SqlCommand check_Member = new SqlCommand("SELECT * FROM Members WHERE MembershipID = FirstName AND LastName = @Txtnput", DBConnection);
check_Member.Parameters.AddWithValue("@Txtnput", txtMembershipid.Text);
int MemberExist = (int)check_Member.ExecuteScalar();