Last active
November 20, 2018 08:45
-
-
Save canokay/4ad45a027fa239c1b40c330dd0e979ef to your computer and use it in GitHub Desktop.
C# Multiple Tables Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
using System.Data; | |
using System.Data.OleDb; | |
namespace Ders3Uygulama1 | |
{ | |
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ | |
InitializeComponent(); | |
} | |
private void Form1_Load(object sender, EventArgs e) | |
{ | |
} | |
private void button1_Click(object sender, EventArgs e) | |
{ | |
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=veritabani.mdb"); | |
DataSet ds; | |
ds = new DataSet(); | |
OleDbDataAdapter verial1 = new OleDbDataAdapter("select * from ogr1", con); | |
OleDbDataAdapter dtUrun= new OleDbDataAdapter("select * from ogr2", con); | |
DataTable dtKat = new DataTable("ogr1"); | |
verial1.Fill(dtKat); | |
DataTable dtUrun2 = new DataTable("ogr2"); | |
verial1.Fill(dtUrun2); | |
DataRelation dr; | |
ds.Tables.Add(dtKat); | |
ds.Tables.Add(dtUrun2); | |
dr = new DataRelation("ogr1_den_gecis_yap_ogr2", dtKat.Columns["okul_no"], dtUrun2.Columns["okul_no"]); | |
ds.Relations.Add(dr); | |
dataGrid1.DataSource = ds; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment