using System; using System.Data.SqlClient; class Baasiproov1b{ public static void Main(string[] arg){ string constr="Data Source=RINDE\\SQLEXPRESS;"+ "Initial Catalog=proovibaas; "+ "Integrated Security=SSPI; Persist Security Info=False"; string lause="SELECT COUNT(*) FROM inimesed"; SqlConnection cn=new SqlConnection(constr); cn.Open(); SqlCommand cm = new SqlCommand(lause, cn); Console.WriteLine("Inimeste arv: "+cm.ExecuteScalar()); cn.Close(); } } /* D:\kodu\0606\dotnet>Baasiproov1b Inimeste arv: 3 */