How can I display single value from SQL Server database in C# ?
I have a total of 8 columns in database and I want to display a count of the 4th column in a MessageBox
cn.Open();
str = "select count(name) from Student";
cmd = new SqlCommand(str,cn);
reader = cmd.ExecuteReader();
MessageBox.Show(reader.ToString());
cmd.Dispose();
reader.Close();
cn.Close();