protected Boolean loginMember()
        {
            SqlConnection conLogin = new SqlConnection(ConfigurationManager.ConnectionStrings["connMSJ"].ConnectionString);
            SqlCommand cmdLogin;
            conLogin.Open();
            cmdLogin = new SqlCommand("SELECT Username, Password FROM Member WHERE (UserName=@ID AND Password=@Pass)", conLogin);
            cmdLogin.Parameters.AddWithValue("@ID", txtID.Text);
            cmdLogin.Parameters.AddWithValue("@Pass", txtPassword.Text);
            SqlDataReader myReader = cmdLogin.ExecuteReader();
            if (myReader.Read())
                return true;
            else
                return false;   
        }

When i execute the login button will fire this event,
if return true to response.redirect("page2.aspx") otherwise will display a message box.
But after execute the login button, it show me this error and hightlighted
conLogin.Open();

If youget that message, then most likely line 3 failed to create a new object. Perhaps because the connection string is missing or invalid.

I think i figure what's the problem already.
The connection name is valid & correct but i didn't open again the web page instead of keep refreshing the previous one (old version; before modify)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.