Exemplo n.º 1
0
        //Get the details of a particular ogrenci
        public Ogrenci GetOgrenciData(int?id)
        {
            Ogrenci ogrenci = new Ogrenci();

            using (SqlConnection con = new SqlConnection(ConnectionString))
            {
                string     sqlQuery = "SELECT * FROM Ogrenci WHERE ogrenci_no= " + id;
                SqlCommand cmd      = new SqlCommand(sqlQuery, con);

                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    cmd.Parameters.AddWithValue("@ogrenci_no", ogrenci.ogrenci_no);
                    cmd.Parameters.AddWithValue("@ogrenci_ad", ogrenci.ogrenci_ad);
                    cmd.Parameters.AddWithValue("@ogrenci_soyad", ogrenci.ogrenci_soyad);
                    cmd.Parameters.AddWithValue("@ogrenci_email", ogrenci.ogrenci_email);
                    cmd.Parameters.AddWithValue("@ogrenci_sifre", ogrenci.ogrenci_sifre);
                }
            }
            return(ogrenci);
        }