Screenshot
Şekil 1
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
OleDbConnection baglan = new OleDbConnection("Provider=Microsoft.Ace.Oledb.12.0;Data Source=
northwind.accdb");
OleDbDataAdapter da = new OleDbDataAdapter();
OleDbCommand cmd = new OleDbCommand();
DataSet ds = new DataSet();
baglan.Open();
cmd.CommandText = "Select ID, FirstName,LastName,JobTitle,City From
Customers ";
da.SelectCommand = cmd;
cmd.Connection = baglan;
da.Fill(ds, "Customers");
listBox1.DataSource = ds;
listBox1.DisplayMember = "Customers.FirstName";
this.textBox1.DataBindings.Add("Text", ds, "Customers.ID");
baglan.Close();
}
}
}
Bir makalenin daha sonuna geldik. Bir sonraki makalede
görüşmek üzere. Bahadır ŞAHİN
0 comments:
Yorum Gönder