Home » » C# — Accessteki sorguyu datagridview’de Gösterme
17 Ocak 2014 Cuma
undefined

C# — Accessteki sorguyu datagridview’de Gösterme

Accessteki sorguyu datagridview’de Gösterme C#
projemizin bin-debug klasöründe data isminde bir access(2007) dosyası oluşturuyoruz.yukarıdaki tabloyu oluşturup ogrbil isminde kaydediyoruz.
Alan türleri
id–>otomatik sayı
ad-soyad-sınıf–>metin
Yukarıdaki sorguyu oluşturup sorgu isminde kaydediyoruz.Aşağıdaki formu oluşturuyoruz.
Not :  Eğer access dosyasını 2003′te oluşturuyorsanız Microsoft.Ace.Oledb.12.0 yerine Microsoft.Jet.Oledb.4.0 yazıyoruz.
using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq; //www.gorselprogramlama.com

using System.Text;

using System.Windows.Forms;

using System.Data.OleDb;

namespace access_stored_Queries

{

public partial class Form1 : Form

{

public Form1()

{ //www.gorselprogramlama.com

InitializeComponent();

}

OleDbConnection bag = new OleDbConnection("Provider=Microsoft.Ace.Oledb.12.0;Data Source=data.accdb");

OleDbCommand kmt = new OleDbCommand();

DataTable dt=new DataTable(); //www.gorselprogramlama.com

OleDbDataAdapter adtr = new OleDbDataAdapter();

private void button1_Click(object sender, EventArgs e)

{

kmt.Connection = bag;

kmt.CommandType = CommandType.StoredProcedure; //www.gorselprogramlama.com

kmt.CommandText = "sorgu";

OleDbDataAdapter adtr = new OleDbDataAdapter(kmt);

bag.Open(); //www.gorselprogramlama.com

adtr.Fill(dt);

dataGridView1.DataSource = dt;

bag.Close();

}
}
}
C# — FileStream ile dosya okuma

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; ...

Fiyatı ve kdv’si girilen ürünün kdvli fiyatını hesaplama C# Console

Fiyatı ve kdv’si girilen ürünün kdvli fiyatını hesaplama C# Console    namespace kdvl...

C# — Xml dosyasının içeriğini datagridview’e aktarmak

Xml dosyasının içeriğini datagridview’e aktarmak C# Aşağıdaki xml dosyasını oluşturup veri.xml ...

C# — Picturebox’ı formun etrafında hareket ettirme

Picturebox’ı formun etrafında dolaştırma C# Aşağıdaki formu oluşturalım.(resim ekleme–> ...

C# — Bilgisayar kapatma programı

Bilgisayar kapatma programı C# using System; using System.Collections.Generic; using System....

C# — Dal Seçimi Programı

Dal Seçimi Programı C# using System; using System.Collections.Generic; using System.Comp...

 
Support : Vaganzi
Copyright © 2013. Visual Studio Kod Bankası - All Rights Reserved
Powered By Vaganzi