Chào mừng đến với Diễn đàn lập trình - Cộng đồng lập trình.
Kết quả 1 đến 3 của 3
  1. #1

    hien thi kieu du lieu combobox

    help me!
    sql data table



    mình muốn combobox chỉ hiển thị duy nhất 1 giá tri giống nhau thì lam sao? các bạn giúp mình nhé
    sử dụng entity framwork

    code

    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;

    namespace WindowsFormsApplication1
    {
    public partial class Machine : Form
    {
    FKVS mch;
    int a = 0;
    public Machine()
    {
    InitializeComponent();
    }

    private void button2_Click(object sender, EventArgs e)
    {
    this.Close();
    }

    private void button1_Click(object sender, EventArgs e)
    {
    MAIN_TR tr = new MAIN_TR();
    //tr.ID = Convert.ToInt32(null);
    tr.Description = textBox1.Text;
    tr.Key = int.Parse(comboBox1.Text);
    mch.AddToMAIN_TR(tr);
    mch.SaveChanges();

    }

    private void Machine_Load(object sender, EventArgs e)
    {
    mch =new FKVS();
    comboBox1.DataSource = mch.MAIN_TR.Where(c=>c.Key<5);
    comboBox1.DisplayMember = "Decription";
    comboBox1.ValueMember = "key";
    }
    }
    }

  2. #2
    Ngày tham gia
    Sep 2015
    Bài viết
    0
    xài từ khóa DISTINCT trong SQL

  3. #3
    Vọc trong SQL query ấy.

    Nhầm box roài.

 

 

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •