示例#1
0
        public static DataTable DataTableGetir(string sql)
        {
            SqlConnection  baglan  = Baglanti.baglan();
            SqlDataAdapter adapter = new SqlDataAdapter(sql, baglan);
            DataTable      dt      = new DataTable();

            try
            {
                adapter.Fill(dt);
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            adapter.Dispose();
            baglan.Close();
            baglan.Dispose();
            return(dt);
        }
示例#2
0
        public static int idu(string sqlcumle)
        {
            SqlConnection baglan = Baglanti.baglan();
            SqlCommand    sorgu  = new SqlCommand(sqlcumle, baglan);
            int           sonuc  = 0;

            try
            {
                sonuc = sorgu.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            sorgu.Dispose();
            baglan.Close();
            baglan.Dispose();
            return(sonuc);
        }