13 Aralık 2017 Çarşamba
C Sharp Kitaplık Programı Kitap Sınıfı
UYGULAMAYI İNDİR
Kaydol:
Kayıt Yorumları
(
Atom
)
/// Kitaplar sınıfı using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Kitaplik.Entity { public class Kitaplar { public int KitapID { get; set; } public int KitapNo { get; set; } public string KitapAdi { get; set; } public string YazarAdi { get; set; } public string YayinEvi { get; set; } public DateTime YayinTarihi { get; set; } public string Tur { get; set; } public int RafNo { get; set; } public string RafAyrac { get; set; } public string Dil { get; set; } public string Icerik { get; set; } } } /// Tools sınıfı using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlClient; using System.Data.OleDb; using System.Data; namespace Kitaplik.Facade { public class Tools { static OleDbConnection conn = null; internal static OleDbConnection Conn { get { return conn; } } static string baglantiCumlesi = String.Empty; public static string BaglantiCumlesi { get { return Tools.baglantiCumlesi; } set { Tools.baglantiCumlesi = value; conn = new OleDbConnection(); conn.ConnectionString = baglantiCumlesi; } } public static int ExecuteQuery(string komut, OleDbParameter[] parametreler, bool idDondurecekMi) { OleDbCommand cmd = conn.CreateCommand(); cmd.CommandText = komut; int donecekDeger = -1; if (parametreler != null) cmd.Parameters.AddRange(parametreler); if (conn.State == ConnectionState.Closed) conn.Open(); try { donecekDeger = idDondurecekMi ? Convert.ToInt32(cmd.ExecuteScalar()) : cmd.ExecuteNonQuery(); } catch (Exception e) { string a = e.Message; donecekDeger = -1; } conn.Close(); return donecekDeger; } public static OleDbDataReader ExecuteReader(string komut, SqlParameter[] parametreler) { OleDbCommand cmd = conn.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = komut; if (parametreler != null) cmd.Parameters.AddRange(parametreler); if (cmd.Connection.State == ConnectionState.Closed) cmd.Connection.Open(); OleDbDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); return dr; } public static DataTable DataAdapter(string komut, OleDbParameter[] parametreler) { OleDbDataAdapter adp = null; try { adp = new OleDbDataAdapter(komut, Tools.Conn); } catch (Exception) { throw; } if (parametreler != null) adp.SelectCommand.Parameters.AddRange(parametreler); DataTable dt = new DataTable(); adp.Fill(dt); return dt; } }
Hiç yorum yok :
Yorum Gönder