That should work as a console app - with the exception that I'd normally expect a Namespace as well as a class.
Try making sure that you have this at the top of the file:
using System;
namespace TCFConsole
{
And a matching "}" at the end.
And BTW: SELECT has only one "s":
command.CommandText = "selsct * from student";
^
"Okey, can you please give me the brief example of parameterised query and how I need to write its code and what I need to mention there, because I am new to C#."
using (SqlConnection con = new SqlConnection(strConnect))
{
con.Open();
using (SqlCommand cmd = new SqlCommand("INSERT INTO myTable (myColumn1, myColumn2) VALUES (@C1, @C2)", con))
{
cmd.Parameters.AddWithValue("@C1", myValueForColumn1);
cmd.Parameters.AddWithValue("@C2", myValueForColumn2);
cmd.ExecuteNonQuery();
}
}