"incorrect syntax near the word DISTINCT"
private SqlConnection con; private SqlCommand cmd; private SqlDataReader dr; openConnection(); string qry1 = "SELECT COUNT (V1) FROM votes GROUP BY DISTINCT V1"; cmd = new SqlCommand(qry1, con); dr = cmd.ExecuteReader(); while (dr.Read()) { count = dr[0].ToString(); } int ans= Convert.ToInt32(count); MessageBox.Show(Convert.ToString(ans)); closeConnection();
SELECT COUNT (DISTINCT V1) FROM votes group by v1;
string qry1 = "SELECT COUNT (V1) FROM votes GROUP BY DISTINCT V1";
string qry1 = "SELECT COUNT (V1) FROM votes GROUP BY V1";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)