Nimetu
using System;
using System.Data;
using System.Data.SqlClient;
class Baasiparameeter1{
public static void Main(string[] arg){
string constr="Data Source=RINDE\SQLEXPRESS;"+
"Initial Catalog=baas1; "+
"Integrated Security=SSPI; Persist Security Info=False";
string lause="kysiLapsed";
SqlConnection cn=new SqlConnection(constr);
cn.Open();
SqlCommand cm = new SqlCommand(lause, cn);
cm.CommandType=CommandType.StoredProcedure;
cm.Parameters.Add("@algaasta", SqlDbType.Int).Value=1997;
SqlDataReader reader=cm.ExecuteReader();
while(reader.Read()){
Console.WriteLine(reader.GetString(0)+": "+
reader.GetInt32(1));
}
cn.Close();
}
}
/*
D:kodu 606dotnet>Baasiparameeter2
Juku: 1997
Kati: 1997
Siim: 1997
*/
Ülesandeid
* Loo andmebaasitabelid: maakonnad (id, maakonnanimi), autod (id, mark, aasta, maakonna_id).