Ataturk

 

 

 

 

 

 

 

 

 

 

 

 

                                                                                                                                            

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

public partial class yonetim_kategoriler : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
OleDbConnection c = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;DATA Source=" + Server.MapPath("~/App_Data/vt.mdb"));
c.Open();
OleDbCommand com = new OleDbCommand();
com.CommandText = "insert into ilanlar(durum,baslik,aciklama,fiyat,kimden,resim,katid,tarih) values (@d, @b, @acik, @f, @kim, @r, @katid ,@tarih)";
com.Parameters.AddWithValue("@d", DropDownList1.SelectedValue);
com.Parameters.AddWithValue("@b", TextBox1.Text);
com.Parameters.AddWithValue("@acik", FCKeditor1.Value);
com.Parameters.AddWithValue("@f", TextBox2.Text);
com.Parameters.AddWithValue("@kim", RadioButtonList1.SelectedValue);
com.Parameters.AddWithValue("@r", FileUpload1.FileName);
com.Parameters.AddWithValue("@katadi", DropDownList2.SelectedValue);
com.Parameters.AddWithValue("@tarih", DateTime.Now.ToShortDateString());    // bugünkü tarihi atar
com.Connection = c;
com.ExecuteNonQuery();
Response.Write("kayıt yapıldı");
FileUpload1.SaveAs(Server.MapPath("~/resimler/"+FileUpload1.FileName));
c.Close();
GridView1.DataBind();


}
}