This is the error I'm getting:
System.Data.SqlClient.SqlException: Incorrect syntax near ','. error
This is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Configuration;
namespace LOGIN_PAGE
{
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["sqlcon"].ToString());
string s = "select count(*) from signup where [username]='" + txtusername.Text + "' , [passwd]= '" + txtpasswd.Text + "'";
SqlCommand cmd = new SqlCommand(s, con);
con.Open();
int i = Convert.ToInt32(cmd.ExecuteScalar());
if(i>0)
{
Response.Redirect("analysis.aspx");
}
else
{
lblDisplay.Text=("Invalid User Credentials..");
}
con.Close();
}
}
}
Could someone point me in the right direction to find what's causing this error and how to solve it?