Thursday, March 5, 2026

flutter uygulama



 import 'package:flutter/material.dart';


void main() {
  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: HomePage(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color.fromARGB(255, 226, 102, 31),
      appBar: AppBar(
        backgroundColor: const Color.fromARGB(255, 226, 102, 31),
        title: Text(
          "Bu başlığımız",
          style: TextStyle(
            fontSize: 18,
            color: Colors.white,
            fontFamily: "Times New Roman",
            letterSpacing: 1.5,
          ),
        ),
        centerTitle: true,
      ),
      body: Center(
        child: Container(
          width: 280,
          height: 350,
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(10),
          ),
          child: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 20),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                SizedBox(
                  height: 40,
                ),
                Center(
                  child: Text(
                    "User Profile",
                    style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
                  ),
                ),
                SizedBox(
                  height: 15,
                ),
                Center(
                  child: SizedBox(
                    width: 100,
                    height: 100,
                    child: CircleAvatar(
                      backgroundImage: AssetImage("assets/recep.jpg"),
                    ),
                  ),
                ),
                SizedBox(
                  height: 10,
                ),
                Text(
                  "Name",
                  style: TextStyle(fontSize: 10),
                ),
                Container(
                  width: double.infinity,
                  padding: EdgeInsets.only(bottom: 5),
                  decoration: BoxDecoration(
                    border: Border(
                      bottom: BorderSide(width: 0.5),
                    ),
                  ),
                  child: Text(
                    "Recep ÖZEN",
                    style: TextStyle(fontSize: 14, fontFamily: "Arial"),
                  ),
                ),
                SizedBox(
                  height: 10,
                ),
                Text(
                  "Location",
                  style: TextStyle(fontSize: 10),
                ),
                Container(
                  width: double.infinity,
                  padding: EdgeInsets.only(bottom: 5),
                  decoration: BoxDecoration(
                    border: Border(
                      bottom: BorderSide(width: 0.5),
                    ),
                  ),
                  child: Text(
                    "SAKARYA",
                    style: TextStyle(fontSize: 14, fontFamily: "Arial"),
                  ),
                ),
                SizedBox(
                  height: 10,
                ),
                Text(
                  "Favori Diller",
                  style: TextStyle(fontSize: 10, color: Colors.blue),
                ),
                Container(
                  width: double.infinity,
                  padding: EdgeInsets.only(bottom: 5),
                  decoration: BoxDecoration(
                    border: Border(
                      bottom: BorderSide(width: 0.5),
                    ),
                  ),
                  child: Text(
                    "İngilizce, Boşnakça",
                    style: TextStyle(fontSize: 14, fontFamily: "Arial"),
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

Tuesday, March 3, 2026

mysl bağlantı .net framework form için

 using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using MySql.Data.MySqlClient;


namespace WindowsFormsApp6

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

        

        private void button1_Click(object sender, EventArgs e)

        {

            // Bir veritabanına bağlantı için connectionstring adı verilen bilgi ifadesi gereklidir.

            string connStr = "Server=localhost;Database=dersdb;Uid=root;Pwd=1234;";


            // MySQL kullandığımız için mysql bağlantısı gerekiyor.

            // Tools->Nuget->Manage Nuget tan : Mysql.Data yı projemize ekliyoruz.


            // Eklemeyi yaptı iseniz, artık mysql kütüphanesi kullanılabilir

            // MySqlConnection, verilen Connection String ifadesini kullanarak mysql e bağlantı sağlar


            MySqlConnection conn = new MySqlConnection(connStr);


            // conn.Open() diyerek, bağlantı sağlanabilir, ancak bağlantı kurulamaz ise hata oluşur.

            // dolayısı ile try içinde kullanmak mantıklıdır.


            try

            {

                conn.Open(); // bağlantıyı aç

                // Tamam bağlantıyı sağladık, veritabanında ne yaparız.

                // veritabanında sorgular yapar, gelen verilere göre iş yaparsın.

                // o halde veritabanına sorgu göndermem gerekiyor. 

                // bunu MysqlDataAdapter sağlar.

                string query = "select * from ogrenciler";

                MySqlDataAdapter da = new MySqlDataAdapter(query, conn);

                // yukarıda dataadaptörümüze sorguyu ve bağlantı bilgisini verdik.


                // sorgu neticesinde geriye bir tablo geliyor, 

                // bu durumda bunu tutacak bir tabloya ihtiyacım var.

                DataTable dt = new DataTable();

                da.Fill(dt); // dataadapterdeki sorguyu çalıştır, sonucu dt ye doldur.


                dataGridView1.DataSource = dt;

            }

            catch (Exception)

            {


                // throw; // bunu silmen lazım

            }



        }

    }

}