public static class DBbaglanti
{
public static string conString = ConfigurationManager.ConnectionStrings["DBBaglanti"].ConnectionString;
public static bool ExecuteNonQuery(SqlCommand komut)
{
try
{
return komut.ExecuteNonQuery() > 0;
}
catch (Exception ex)
{
string hataOlustu = ex.Message;
return false;
}
}
}
//Kullanımı
public bool KullaniciEkle(Kullanici _kullanici)
{
using (SqlConnection con = new SqlConnection(DBbaglanti.conString))
{
using (SqlCommand komut = new SqlCommand("sp_Ekle", con))
{
con.Open();
komut.CommandType = CommandType.StoredProcedure;
komut.Parameters.AddWithValue("@AdSoyad", _kullanici.AdSoyad);
return DBbaglanti.ExecuteNonQuery(komut);
}
}
}