Code To SELECT + WHERE in Access Db using c#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace SecondOne
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection n = new SqlConnection();
            n.ConnectionString = "Data Source=LENOVO-PC;Initial Catalog=DicleYilmaz;Integrated Security=True";
            n.Open();

            SqlCommand d = new SqlCommand();
            d.Connection = n;
            d.CommandText = "Select * from URUNLER WHERE URUN_ADI LIKE 'p%' ";
;
            SqlDataReader reader = d.ExecuteReader();
            while (reader.Read())
            {
                string s = (String)reader["URUN_ADI"];
                MessageBox.Show(s);
            }
        }
    }
}

Yorumlar

Popüler Yayınlar