Jump to content
Son zamanlarda artan kullanıcı hesap hırsızlıkları sebebiyle tüm kullanıcılara şifre sıfırlama maili gönderilmiştir. Lütfen güveli şifreler seçiniz. Mevcut e-mail adresinize erişemiyorsanız, en aşağıdaki destek linkinden bize ulaşınız. ×

C# Access Den Listview1 Veri çekme


fatih29
 Share

Recommended Posts

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.OleDb;
                        
namespace İlaç_Bul
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public OleDbConnection con;  
        public OleDbDataReader dr;
        public OleDbCommand cmd;

        private void button1_Click(object sender, EventArgs e)
        {
            if(textBox1.Text == string.Empty)
            {
                MessageBox.Show("İlaç Adı Giriniz");
            }
            else
            {
                listView1.Items.Clear();
                con = new OleDbConnection("Provider=Microsoft.ACE.Oledb.12.0;Data Source=ilac.accdb");
                coa.Open();c
                cmd = new OleDbCommand("Selact* From veriler", con);
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    ListViewItem item = new ListViewItem(dr["id"].ToString());
                    item.SubItems.Add(dr["ilac-adi"].ToString());
                    item.SubItems.Add(dr["il"].ToString());
                    item.SubItems.Add(dr["eczaneler"].ToString());
                    listView1.Items.Add(item);
                }
                coan.Close();
            }
        }
    }
}

 

 

 

 

==========================================================

con.Open hatası alıyorum veriyi çekemiyorum yardım edebilirmisiniz tşk.

Proje Yönetimi.rar

Edited by fatih29
Link to comment
Share on other sites

Build, projenin belirtilen seçenekler doğrultusunda derlenmesi demektir. 

Sadece yazılan ilacın isminin gelmesi için;
 

     if (dr["ilac-adi"].ToString() == textBox1.Text)
                    {
                        ListViewItem item = new ListViewItem(dr["id"].ToString());
                        item.SubItems.Add(dr["ilac-adi"].ToString());
                        item.SubItems.Add(dr["il"].ToString());
                        item.SubItems.Add(dr["eczaneler"].ToString());
                        listView1.Items.Add(item);
                    }

 

Link to comment
Share on other sites

 if (dr["ilac-adi"].ToString() == textBox1.Text) ///====> Bu kod AB==AB şeklinde peki Ab==AB nasıl yapabiliriz
                    {
                        ListViewItem item = new ListViewItem(dr["id"].ToString());
                        item.SubItems.Add(dr["ilac-adi"].ToString());
                        item.SubItems.Add(dr["il"].ToString());
                        item.SubItems.Add(dr["eczaneler"].ToString());
                        listView1.Items.Add(item);

 

yani ListViewItem  de olan "ababab" şeklindeki yazıyı biz "ABABAB " DİYE  ÇAGIRA BİLİRMİYİZ TŞK.. EMEGİN İÇİN

Edited by fatih29
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...