ASP.NET(C#) ile Kayıt Listeleme, Silme ve Düzenleme İşlemi



Similar documents
1.Tüm Kayıtları Getirme - Arama Yapma

Conexión SQL Server C#

How To Create A Database In Araba

Database Communica/on in Visual Studio/C# using ASP.NET Web Forms. Hans- PeBer Halvorsen, M.Sc.

İNTERNET TABANLI PROGRAMLAMA- 13.ders GRIDVIEW, DETAILSVIEW, ACCESSDATASOURCE NESNELERİ İLE BİLGİ GÖRÜNTÜLEME

A PROJECT REPORT ON. SkyDrive. Submitted for the partial fulfillment of the requirement for the Award of the degree of MASTER OF COMPUTER APPLICATION

{ oledbdataadapter1.updatecommand.commandtext = "update personel set ad='" + textbox2.text + "' where id=" + textbox1.text; oledbconnection1.

C# Datenbank-Programmierung

To be able to use web parts to create a portal-style web application

I A Form és a párbeszédablakok I.1. MessageBox osztály MessageBox.Show(szöveg[,cím[,gombok[,ikon[,defaultbutton]]]]);

ASP and ADO (assumes knowledge of ADO)

GoDaddy (CentriqHosting): Data driven Web Application Deployment

1. La classe Connexion class Connexion {

ASP.NET Programming with C# and SQL Server

listboxgaatmee.dragdrop += new DragEventHandler(listBox_DragDrop); ListBox from = (ListBox)e.Data.GetData(typeof(ListBox));

Aplicação ASP.NET MVC 4 Usando Banco de Dados

Creating the Product Catalog Part I (continued)

Working with Data in ASP.NET 2.0 :: Creating Stored Procedures and User Defined Functions with Managed Code Introduction

5 Airport. Chapter 5: Airport 49. Right-click on Data Connections, then select Add Connection.

Real-World ASP.NET: Building a Content Management System

Systems Programming & Scripting

Hi, processing. Code of the vb.net version. Imports System.Data Imports System.Data.SqlClient

ADOBE READER AND ACROBAT

Database Communica/on in Visual Studio/C# using Web Services. Hans- Pe=er Halvorsen, M.Sc.

Matière : Application Web avec C#

O Reilly Media, Inc. 3/2/2007

Introduction to ASP.NET Web Development Instructor: Frank Stepanski

VB.NET - DATABASE ACCESS

AD A O.N. ET E Access Data Object

A Tutorial on SQL Server CMPT 354 Fall 2007

Lab 8: ASP.NET 2.0 Configuration API and Health Monitoring

JSF (Java Server Faces) Melih Sakarya

VB.NET - WEB PROGRAMMING

Apprenda.NET Developer Tutorial

Creating Form Rendering ASP.NET Applications

How To Develop A Mobile Application On Sybase Unwired Platform

In this chapter, you will learn how to...

2. Modify default.aspx and about.aspx. Add some information about the web site.

How to use SSO with SharePoint 2010 (FBA) using subdomains. Moataz Esmat EXT.1386

Capturx for SharePoint 2.0: Notification Workflows

Security API Cookbook

Architecture design. Use of some Microsoft patterns & practices for Architecture Guidance (

Apprenda SaaS Developer Tutorial

ASP.NET Dynamic Data

A Step by Step Guide for Building an Ozeki VoIP SIP Softphone

Tutorial: Windows Mobile Application Development. Sybase Unwired Platform 2.1 ESD #2

如 何 在 C#.2005 中 使 用 ICPDAS I/O Card 的 DLL 檔 案

HACKING AUTHENTICATION CHECKS IN WEB APPLICATIONS ASHISH RAO & SIDDHARTH ANBALAHAN

Interaction Tracker Interaction Segments

(Ch: 1) Building ASP.NET Pages. A. ASP.NET and the.net Framework B. Introducing ASP.NET Controls C. Adding Application logic to an ASP.

Tutorial 1: M/M/n Service System Simulation Tutorial 2: M/M/n Simulation using Excel input file Tutorial 3: A Production/Inventory System Simulation

Using IRDB in a Dot Net Project

PROCEDURE INSERTION(NUM IN EMPLOYES.NUMEMP%TYPE, NOM VARCHAR2, PRENOM IN VARCHAR2, PPHOTO IN BLOB, SALAIRE IN NUMBER);

Intermediate ASP.NET Web Development with C# Instructor: Frank Stepanski. Data Sources on the Web

Virtual Terminal Credit Card

HTML Lesson 7. Your assignment:

Introduction to ASP.NET and Web Forms

Sending Data from a computer to a microcontroller using a UART (Universal Asynchronous Receiver/Transmitter)

Assignment 4 Component 6 Project Management System

SQL Server Database Web Applications

Hands-On Lab. Client Workflow. Lab version: Last updated: 2/23/2011

Log/Process/Hashing. Details. Activities. Processes

NEAR EAST UNIVERSITY. Faculty of Engineering

SQL injection attacks SQL injection user input SQL injection SQL Command parameters Database account. SQL injection attacks Data Code

MS Enterprise Library 5.0 (Logging Application Block)

Login with other services to ASP.NET websites with TMS Cloud Pack for.net

White Paper. Creation of Online Help for Fabasoft Folio. Fabasoft Folio 2015 Update Rollup 2

VIRTUAL TERMINAL CREDIT CARD

Directories Web Services

Lecture 9 HTML Lists & Tables (Web Development Lecture 3)

Transition your MCPD Web Developer Skills to MCPD ASP.NET Developer 3.5 (VB)

Aucune validation n a été faite sur l exemple.

Expanded contents. Section 1. Chapter 2. The essence off ASP.NET web programming. An introduction to ASP.NET web programming

NEWSTAR Sales. Web Lead Guide. April 2009 Constellation HomeBuilder Systems, Inc. All right reserved

Chapter 14 WCF Client WPF Implementation. Screen Layout

Licensed for viewing only. Printing is prohibited. For hard copies, please purchase from

Implementing Specialized Data Capture Applications with InVision Development Tools (Part 2)

ResellerPlus - Bulk Http API Specification. (This Document gives details on how to send messages via the Bulk HTTP API for the RouteSms SMPP System)

An Overview of SQL CLR

BACKING UP A DATABASE

DECLARATION OF PERFORMANCE NO. HU-DOP_TD-25_001

Installing the ASP.NET VETtrak APIs onto IIS 5 or 6

Membuat Aplikasi Berita Sederhana

MyChartWebPart.cs. // For SortList using System.Collections.Generic; using System.Collections; // For DataTable using System.Data;

Analytics Configuration Reference

Step-by-Step Guide for Active Directory Federation Services

How To: Create a Crystal Report from ADO.NET Dataset using Visual Basic.NET

CHAPTER 13 Getting Started with Identity

Getting Started with Telerik Data Access. Contents

Transcription:

ASP.NET(C#) ile Kayıt Listeleme, Silme ve Düzenleme İşlemi Web.config içerisine aşağıdaki kod eklenir. <connectionstrings> <add name="bagstr" connectionstring="data Source=(LocalDB)\v11.0;AttachDbFilename= DataDirectory \Database.mdf;Integrated Security=True" providername="system.data.sqlclient" /> </connectionstrings> YetkiliKullaniciDuzenle.aspx.cs //eklemeler using System.Data; using System.Data.SqlClient; using System.Configuration; public partial class admin_yetkilikullaniciduzenle : System.Web.UI.Page SqlConnection bag = new SqlConnection(); SqlCommand komut = new SqlCommand(); SqlCommand komut2 = new SqlCommand(); SqlDataReader dr; static string kad; void verigetir() // Altprogram komut.commandtext = "SELECT * FROM YetkiliKullanici"; dr = komut.executereader(); Label3.Text = "<table border=1 cellpadding=3 width=700>"; Label3.Text += "<tr bgcolor='#b6cfee'>"; Label3.Text += "<th>id</th>"; Label3.Text += "<th>kullanıcı Adı</th>"; Label3.Text += "<th>şifre</th>"; Label3.Text += "<th>ad</th>"; Hazırlayan: Durhan GABRALI - 2015 1

Label3.Text += "<th>soyad</th>"; Label3.Text += "<th>e-mail</th>"; Label3.Text += "<th>kayıt Tarihi</th>"; Label3.Text += "<th>düzenleme</th>"; Label3.Text += "<th>silme</th>"; Label3.Text += "</tr>"; int i = 1; string renk = "#ffffff"; while (dr.read()) if (i % 2 == 0) renk = "#d5d9de"; renk = "#ffffff" ; i++; Label3.Text += "<tr bgcolor='" + renk + "'>"; Label3.Text += "<td>" + dr[0] + "</td>"; //id Label3.Text += "<td>" + dr[1] + "</td>"; //Kad Label3.Text += "<td>" + dr[2] + "</td>"; //Sifre Label3.Text += "<td>" + dr[3] + "</td>"; //Ad Label3.Text += "<td>" + dr[4] + "</td>"; //Soyad Label3.Text += "<td>" + dr[5] + "</td>"; //Email Label3.Text += "<td>" + dr[6] + "</td>"; //Ktarih Label3.Text += "<td> <a href='?did=" + dr[0].tostring() + "'>Düzenle</a> </td>"; Label3.Text += "<td> <a href='?silid=" + dr[0].tostring() + "' onclick='return silkontrol()'>sil</a> </td>"; Label3.Text += "</tr>"; Label3.Text += "</table>"; protected void Page_Load(object sender, EventArgs e) Label2.Text = ""; Label3.Text = ""; Label4.Text = ""; //Silme işlemi ------------------------------------ string id; if (Request.QueryString["silid"]!= null) id = Request.QueryString["silid"].ToString(); komut.commandtext = "DELETE FROM YetkiliKullanici WHERE Id=@p1"; komut.parameters.addwithvalue("@p1", id); int k; k = komut.executenonquery(); if (k == 1) Label2.Text = "Silme gerçekleşti."; Label2.Text = "Silme başarısız!"; komut.parameters.clear(); Hazırlayan: Durhan GABRALI - 2015 2

//Silme - Son ------------------------------------------ //-- Düzenleme İşlemi ------------------------------ if (Request.QueryString["did"]!= null && Page.IsPostBack == false) id = Request.QueryString["did"].ToString(); Panel1.Visible = true; // Güncellenecek kaydın okunup forma getirilmesi bag.connectionstring = ConfigurationManager.ConnectionStrings["bagstr"].ConnectionString; komut.commandtext = "SELECT * FROM YetkiliKullanici WHERE Id=" + id; dr = komut.executereader(); dr.read(); if (dr.hasrows) TextBox6.Text = dr[0].tostring(); // Id TextBox1.Text = dr[1].tostring(); // Kullanıcı adı kad = dr[1].tostring(); //Kullanıcı adını bir değişkene aktarıyoruz TextBox2.Text = dr[2].tostring(); // Şifre TextBox3.Text = dr[3].tostring(); // Ad TextBox4.Text = dr[4].tostring(); // Soyad TextBox5.Text = dr[5].tostring(); // E-mail Label2.Text = "Düzenlenmek istenen kayıt okunamadı!"; //---------------------------------------------- //Düzenleme - Son --------------------------------------------- verigetir(); protected void Button1_Click(object sender, EventArgs e) // Güncelle butonu -------------------------- if (Label4.ForeColor == System.Drawing.Color.Green TextBox1.Text == kad) bag.connectionstring = ConfigurationManager.ConnectionStrings["bagstr"].ConnectionString; komut.commandtext = "UPDATE YetkiliKullanici SET Kad=@p1, Sifre=@p2, Ad=@p3, Soyad=@p4, Email=@p5 WHERE Id=" + TextBox6.Text; komut.parameters.addwithvalue("@p1", TextBox1.Text); //Kullanıcı Adı komut.parameters.addwithvalue("@p2", TextBox2.Text); //Şifre komut.parameters.addwithvalue("@p3", TextBox3.Text); //Ad komut.parameters.addwithvalue("@p4", TextBox4.Text); //Soyad komut.parameters.addwithvalue("@p5", TextBox5.Text); //E-Mail Hazırlayan: Durhan GABRALI - 2015 3

int kontrol; kontrol = komut.executenonquery(); if (kontrol == 1) Label2.Text = "Güncelleme gerçekleşti"; Panel1.Visible = false; Label2.Text = "Güncelleme başarısız!"; komut.parameters.clear(); verigetir(); protected void Button2_Click(object sender, EventArgs e) // İptal butonu ----------------------------- Panel1.Visible = false; protected void TextBox1_TextChanged(object sender, EventArgs e) komut2.commandtext = "SELECT * FROM YetkiliKullanici WHERE Kad=@p1"; komut2.parameters.addwithvalue("@p1", TextBox1.Text); komut2.connection = bag; dr = komut2.executereader(); if (dr.hasrows) Label4.ForeColor = System.Drawing.Color.Red; Label4.Text = "Kullanıcı sistemde kayıtlı!"; Button1.Enabled = false; Label4.ForeColor = System.Drawing.Color.Green; Label4.Text = "Kullanıcı adı kullanılabilir"; Button1.Enabled = true; if (TextBox1.Text == kad) Label4.ForeColor = System.Drawing.Color.Green; Label4.Text = ""; Button1.Enabled = true; komut2.parameters.clear(); Hazırlayan: Durhan GABRALI - 2015 4

Silme İşlemi Düzenleme İşlemi Hazırlayan: Durhan GABRALI - 2015 5