Notes
Notes - notes.io |
using System.Data;
using System.Data.OleDb;
*************************
OTURUM AÇMA
*************************
OleDbConnection bag = new OleDbConnection();
bag.ConnectionString = ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath("~/App_Data/osman.accdb"));
bag.Open();
OleDbCommand komut = new OleDbCommand("select admin_id,admin_pass from admin ", bag);
OleDbDataReader oku = komut.ExecuteReader();
while(oku.Read())
{
if (TextBox1.Text == oku[0].ToString() && TextBox2.Text == oku[1].ToString())
{
Session.Add("oturum",TextBox1.Text);
Response.Redirect("index.aspx");
}
else
{
Label1.Text=("Oturum Açma İşlemi Başarısız..");
}
}
bag.Close();
***************************************
OTURUM KONTROL ETTİRME
*************************************
OleDbConnection bag = new OleDbConnection();
bag.ConnectionString = ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath("~/App_Data/osman.accdb"));
bag.Open();
if (Session["oturum"] == null)
{ Response.Redirect("login.aspx"); }
else
{
Label1.Visible = true;
Button1.Visible = true;
Label1.Text = (Session["oturum"].ToString());
}
bag.Close();
çıkış kod:
Session.Abandon();
**************************
ID YE GÖRE SİLMEK
***************************
{
OleDbConnection bag = new OleDbConnection();
bag.ConnectionString = ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath("~/App_Data/osman.accdb"));
try
{
bag.Open();
OleDbCommand komut1 = new OleDbCommand("select admin_id from admin", bag);
OleDbDataReader oku = komut1.ExecuteReader();
while (oku.Read())
{
if (TextBox1.Text == oku[0].ToString())
{
OleDbCommand komut2 = new OleDbCommand("delete from admin where admin_id='" + TextBox1.Text + "'", bag);
komut2.ExecuteReader();
bag.Close();
Label1.Text = "İşlem Başarılı";
break;
}
else
Label1.Text = "Kayıt Bulunamadı";
}
}
catch
{ Label1.Text = "işlem başarısız"; }
}
*******************************
KAYIT EKLEME
*******************************
OleDbConnection bag = new OleDbConnection();
bag.ConnectionString = ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath("~/App_Data/osman.accdb"));
bag.Open();
OleDbCommand komut = new OleDbCommand ("insert into admin(admin_id,admin_pass) values('"+TextBox1.Text+"','"+TextBox3.Text+"')",bag);
komut.ExecuteNonQuery();
Response.Redirect("login.aspx");
bag.Close();
************************
KAYIT GÜNCELLEME
***********************
bag.Open();
OleDbCommand sifre = new OleDbCommand("select admin_pass from admin where admin_id='" + Label2.Text + "'",bag);
OleDbDataReader oku = sifre.ExecuteReader();
while (oku.Read())
{
if (TextBox2.Text == oku[0].ToString())
{
OleDbCommand guncel = new OleDbCommand("update admin set admin_pass='" + TextBox3.Text + "' where admin_id='" + Label2.Text + "' and admin_pass='" + TextBox2.Text + "'", bag);
guncel.ExecuteNonQuery();
Label1.Text = "Şifre değiştirme işlemi başarılı";
bag.Close();
break;
}
else
{ Label1.Text = "Şifre değiştirme işlemi başarısız"; }
}
************************
OTURUM KONTROL
************************
if (Session["oturum"] == null)
{ Response.Redirect("login.aspx"); }
else
Label2.Text = Session["oturum"].ToString();
}
**********************
HESABIMI KAPAT
**********************
OleDbConnection bag = new OleDbConnection();
bag.ConnectionString = ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath("~/App_Data/osman.accdb"));
bag.Open();
OleDbCommand komut1 = new OleDbCommand("select admin_id from admin", bag);
OleDbDataReader oku = komut1.ExecuteReader();
while (oku.Read())
{
if (Label2.Text == oku[0].ToString())
{
OleDbCommand komut2 = new OleDbCommand("delete from admin where admin_id='" + Label2.Text + "' ", bag);
komut2.ExecuteReader();
bag.Close();
Label1.Text = "Hesabınız sistemden silinmiştir. görüşmek üzere";
Response.Redirect("login.aspx");
break;
}
}
******************************
ÇİFT TEK BULLETE ITEM
******************************
double girilen = Convert.ToInt32(TextBox1.Text);
if (girilen % 2 == 0)
{ cift.Items.Add(TextBox1.Text); }
else if(girilen % 2 ==1)
{ tek.Items.Add(TextBox1.Text); }
***********
RANDOM
***********
Random kod = new Random();
Label1.Text = Convert.ToString(kod.Next(1, 10000));
|
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team