public static void hastaneEkle(Hastane hastane) { SqlConnection sqlbaglanti = openConnection(); SqlCommand veriOku = new SqlCommand("INSERT INTO hastane (hastaneKodu,adi,adresi) VALUES (@hastaneKodu,@adi,@adresi)", sqlbaglanti); veriOku.Parameters.AddWithValue("@hastaneKodu", hastane.getHastaneKodu()); veriOku.Parameters.AddWithValue("@adi", hastane.getAdi()); veriOku.Parameters.AddWithValue("@adresi", hastane.getAdresi()); try { veriOku.ExecuteNonQuery(); } catch (Exception) { } finally { connectionClose(sqlbaglanti); } }
public static void hastaneGuncelle(Hastane hastane) { SqlConnection sqlbaglanti = openConnection(); SqlCommand veriOku = new SqlCommand("UPDATE hastane SET adi=@adi,adresi=@adres where hastaneKodu=@hastaneKodu", sqlbaglanti); veriOku.Parameters.AddWithValue("@hastaneKodu", hastane.getHastaneKodu()); veriOku.Parameters.AddWithValue("@adi", hastane.getAdi()); veriOku.Parameters.AddWithValue("@adres", hastane.getAdresi()); try { veriOku.ExecuteNonQuery(); } catch (Exception) { throw; } finally { connectionClose(sqlbaglanti); } }