1. 2126.
    0
    using System;
    using System. Collections.Generic;
    using System. Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System. Data.OleDb;
    using System. Data;

    namespace WebApplication1
    {
    public partial class WebForm1 : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    if (IsPostBack == false)
    {
    Label2.Text = "Hoşgeldiniz " + Session["kad"].ToString();
    OleDbConnection bag = new OleDbConnection("Provider=Microsoft.ACE. OleDb.12.0;Data Source=" + Server. MapPath("~/Dondurma. accdb"));
    OleDbDataAdapter adt = new OleDbDataAdapter("Select * From Tablo1", bag);

    DataSet ds = new DataSet();

    bag. Open();
    adt. Fill(ds);
    bag. Close();
    GridView1.DataSource = ds;
    GridView1.DataBind();
    }


    }

    protected void Button1_Click(object sender, EventArgs e)
    {
    int i;
    double adet = 0, fiyat = 0, nfiyat = 0;
    for (i = 0; i < GridView1.Rows. Count; i++)
    {
    TextBox tbad = (TextBox)GridView1.Rows[i].FindControl("TextBox1");
    Label lbfi = (Label)GridView1.Rows[i].FindControl("Label1");

    if (tbad. Text != "")

    {
    adet = Convert. ToDouble(tbad. Text);
    fiyat = Convert. ToDouble(lbfi. Text);
    nfiyat += adet * fiyat;



    }
    }
    Label1.Text = nfiyat. ToString("C");

    }

    protected void Button2_Click(object sender, EventArgs e)
    {
    int i;

    for (i = 0; i < GridView1.Rows. Count; i++)
    {
    TextBox tbad = (TextBox)GridView1.Rows[i].FindControl("TextBox1");
    Label lbdad = (Label)GridView1.Rows[i].FindControl("Label2");

    if (tbad. Text != "")
    {
    OleDbConnection bag = new OleDbConnection("Provider=Microsoft.ACE. OleDb.12.0;Data Source=" + Server. MapPath("~/Dondurma. accdb"));


    OleDbCommand kmt = new OleDbCommand();
    kmt. Connection = bag;
    kmt. CommandType = CommandType. Text;
    kmt. CommandText = " insert into Tablo2(kad,dad, adet,tarih) values (@kad,@dad,@adet,@tarih)";

    kmt. Parameters.AddWithValue("@kad",Session["kad"].ToString());
    kmt. Parameters.AddWithValue("@dad",lbdad. Text);
    kmt. Parameters.AddWithValue("@adet", tbad. Text);
    kmt. Parameters.AddWithValue("@tarih", DateTime.Now. ToString());

    bag. Open();
    kmt. ExecuteNonQuery();
    bag. Close();

    Label3.Text = "hayırlı olsun kardeşim. allah rızasıyla siparişin alındı ;) * * * ";

    }
    }

    }
    }
    }

    bime dondurma programı yazıyorum
    Tümünü Göster
    ···
   tümünü göster