SqlServer Connect Disconnect Structure

SqlServer Connect Disconnect Structure

25. April 2009

Read this article in your language IT | EN | DE | ES

Merhaba  arkadaşlar bugün sizlere   bir connect bir de disconnect  yapısının  kontrol  nasıl sağlarız onu anlatacagım 

anlatımdan sonra projeji download edebilirsiniz

 

SQLCONNECT  YAPISININ 

 CONNECT  VE DİSCONNECT  OLAYININ  KULLANIMI  SAGLADIK   VE AYRICA  OPEN / CLOSE / METOD  KULLANIP  DATABASE ÜZERİNDE İŞLEMİ  SAGLADIK  VE BU İŞLEMİ  MESSAGEBOX GÖSTERDİK

BU İŞLEMDE   ÖNEMLİ  NOKTA  İF  KONTROL  SAGLADIK   CONNECTİONSTATE  NE İŞLLEM  YAPAR  NERDE  KULLANILIR  GÖRDÜK
      if (con.State == ConnectionState.Closed)
            {
                con.Open();

            }

            else
            {
                MessageBox.Show("Baglanti Zaten Açık");
            }

----------------------************************************
if (con.State == ConnectionState.Open)
            {
                MessageBox.Show("Database Bağlandi");

              //  MessageBox.Show("Database Version" + con.ServerVersion);


            }

            else
            {
                MessageBox.Show("Bağlan

using System;

using System.Data;

using System.Windows.Forms;

using System.Data.SqlClient;

 

namespace SqlDataOpenConnectDisconnect

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

            /// <summary>

            /// Proje Expansion Database Connect Disconnect Control Structure

            /// Author Orhan Türk

            /// Web Site www.egeonline.com

            /// </summary>

        SqlConnection con = new SqlConnection();

 

        private void Form1_Load(object sender, EventArgs e)

        {

 

            con.ConnectionString = "Data Source=.;Database=Northwind;trusted_connection=true";

 

            con.Open();

        }

 

        private void button1_Click(object sender, EventArgs e)

        {

 

            if (con.State == ConnectionState.Closed)

            {

                con.Open();

 

            }

 

            else

            {

                MessageBox.Show("Baglanti Zaten Açık");

            }

        }

 

        private void button3_Click(object sender, EventArgs e)

        {

            if (con.State == ConnectionState.Open)

            {

                //  MessageBox.Show("Database Bağlandi");

 

 

               //label1.Text = "Database Bağlandi";

 

 

 

                //  MessageBox.Show("Database Version" + con.ServerVersion);

 

 

            }

 

            else

            {

                MessageBox.Show("Bağlanti Kapalı");

            }

 

        }

 

        private void button2_Click(object sender, EventArgs e)

        {

            con.Close();

        }

    }

}

 

 

projeyi inidir 

 

Bir Projenin Sonuna Gene Gelmiş  olduk  başka bir projede görüşmek üzere iyi calışmalar herkeze 

Saygılarımla Orhan Türk 

 

 

 

FacebookDigg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Ado Net , C#

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Sayfa 0.046875 saniyede yuklendi.