Incorrect syntax ASP.NET
<p>I’m very new to ASP.net and have been following a few video tutorials to build a log in page. I successfully created my registration page fine that enters details into my table within the database fine however I can't get my log in page to work =/.I’ve been at this for a few hours and am not sure if any of you can help but it's worth a shot. The IDE I am using is visual studio (latest version).  </p>

<p>I am getting the following error (clicking the image will give a closer view, but you probably already know that): 
<a href="https://i.stack.imgur.com/JanKO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JanKO.jpg" alt="enter image description here"></a></p>

<p>the error changes depending on who I try to log on as for example the above error was returned when trying to log in as john, the below error was returned trying to log in as admin. </p>

<p><a href="https://i.stack.imgur.com/6vPf3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6vPf3.png" alt="enter image description here"></a></p>

<p>shown below is my code used behind the log in button: </p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration; 

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

}

protected void Button2_Click(object sender, EventArgs e)
{
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);
    conn.Open();
    string checkuser = "select count(*) from [Table] where [Login]'" + Loginbox.Text + "'";
    SqlCommand com = new SqlCommand(checkuser, conn);
    int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
    conn.Close();
    if (temp == 1)
    {
        conn.Open();
        string CheckPasswordQuery = "select Password from [Table] where [Login]='" + Loginbox.Text + "'";
        SqlCommand Passcom = new SqlCommand(CheckPasswordQuery, conn);
        string password = Passcom.ExecuteScalar().ToString().Replace(" ","");

        if (password == Passwordbox.Text)
        {
            Session["New"] = Passwordbox.Text; 
            Response.Write("Password is correct");


        }
        else
        {
            Response.Write("Wrong password");

        }
    }
    else {

        Response.Write("User name does not exist");


    }
    }


}
</code></pre>

<p>Shown below is the form page view, which runs perfectly fine, the error gets returned when the log in button is pressed. </p>

<p><a href="https://i.stack.imgur.com/o2kfW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o2kfW.png" alt="enter image description here"></a></p>

<p>Shown below is the table definition: </p>

<p><a href="https://i.stack.imgur.com/tlLwa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tlLwa.png" alt="enter image description here"></a></p>

<p>And shown below is the data contained within the table: </p>

<p><a href="https://i.stack.imgur.com/rWUS4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rWUS4.png" alt="enter image description here"></a></p>

<p>Thank you all for your time and I appreciate any input any of you have to help solve this. </p>