Your code is incomplete. It does not open a connection or execute the query. Also, the query does not Add records to the database. I'm a little confused as to what you are actually trying to accomplish.
Anyway, you'll want to use the ExecuteScalar() method since you're returning a single value; Count(*). Follow the coding pattern in the ADO.NET reference documentation.
SqlCommand.ExecuteScalar Method
Your code will look similar to the following where the username, password, and are passed to a method.
static public int Authenticate(string username, string password, string connString)
{
Int32 count = 0;
string sql = "select count (*) as cnt from LOGINDB where username=@usr and password=@pwd";
using (SqlConnection conn = new SqlConnection(connString))
{
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.Parameters.Add("@usr", SqlDbType.VarChar);
cmd.Parameters["@usr"].Value = username;
cmd.Parameters.Add("@pwd", SqlDbType.VarChar);
cmd.Parameters["@pwd"].Value = password;
try
{
conn.Open();
count = (Int32)cmd.ExecuteScalar();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
return (int)count;
}