在C#窗体中,combobox怎样才能提取access 中某个字段的值,并显示出来

解决方案 »

  1.   

    就是绑定的话,都会出现这样的结果,所以我想问看看,是不是我那里没有设置好
    如图System.Data.DataViewManagerListItemTypeDescriptor 这个值
    怎样解决
      

  2.   

    将你的代码贴出来 才能解决 combox 可以直接绑定table
      

  3.   

    conn.Open();
                    DataSet ds = new DataSet();
                    string sql = "Select   OVERTIME as 时间,MEDINAME as 名称,EPCID as ID号  From hope";
                    OleDbCommand cmd = new OleDbCommand(sql, conn);
                    OleDbDataAdapter dap = new OleDbDataAdapter();
                    dap.SelectCommand = cmd;
                    dap.Fill(ds);
                    dataGridView1.DataSource = ds.Tables[0].DefaultView;                if (ds.Tables[0].Rows.Count != 0)
                    {
                        comboBox2.DataSource = ds; 
                        comboBox2.DisplayMember = "ID号";
                        comboBox2.ValueMember = "ID号";                   
                        conn.Close();
                    }
      

  4.   

    comboBox2.DisplayMember = "名称";
       comboBox2.ValueMember = "ID号";  
      

  5.   


       DataSet ds = new DataSet();
       string sql = "Select OVERTIME as 时间,MEDINAME as 名称,EPCID as ID号 From hope";
       OleDbCommand cmd = new OleDbCommand(sql, conn);
       OleDbDataAdapter dap = new OleDbDataAdapter();
       dap.SelectCommand = cmd;
       dap.Fill(ds);
       conn.Close();
       dataGridView1.DataSource = ds.Tables[0].DefaultView;   if (ds.Tables[0].Rows.Count != 0)
       {
       comboBox2.DataSource = ds;  
      comboBox2.DisplayMember = "名称";
       comboBox2.ValueMember = "ID号";      }
      

  6.   

    还是一样的问题
    没有用
    combobox中 填充的是  System.Data.DataViewManagerListItemTypeDescriptor
      

  7.   


       DataSet ds = new DataSet();
       string sql = "Select OVERTIME as 时间,MEDINAME as 名称,EPCID as ID号 From hope";
       OleDbCommand cmd = new OleDbCommand(sql, conn);
       OleDbDataAdapter dap = new OleDbDataAdapter();
       dap.SelectCommand = cmd;
       dap.Fill(ds);
      conn.Close();
       dataGridView1.DataSource = ds.Tables[0].DefaultView;   if (ds.Tables[0].Rows.Count != 0)
       {
       comboBox2.DataSource = ds;  
      comboBox2.DisplayMember = "ID号";
       comboBox2.ValueMember = "ID号";      } 
    sqldataadapter 不用打开数据库的 而且使用玩就关闭 不要执行玩所有语句在进行关闭
      

  8.   

    comboBox2.DataSource =ds.Tables[0].DefaultView 也绑定这个试一下
      

  9.   

    你是不是 在 combox的change事件里面写了代码了