可以用datareader遍历dbcommand查询的结果。

解决方案 »

  1.   

    ms-help://MS.VSCC/MS.MSDNVS.2052/Vbcon/html/vbtskExecutingDataCommandThatReturnsResultSet.htm
      

  2.   

    还是用的循环呀,只能用循环吗?private void btnLoadListBox_Click(object sender, System.EventArgs e)
    {
       // This method fills a ListBox control with author ids.
       System.Data.OleDb.OleDbDataReader dreader;
       OleDbCommand1.CommandText = "authors";
       OleDbCommand1.CommandType = CommandType.TableDirect;
       OleDbConnection1.Open();
       dreader = OleDbCommand1.ExecuteReader();
    //**
       while( dreader.Read())
       {
          ListBox1.Items.Add(dreader["au_id"]);
       }
       
       dreader.Close();
       OleDbConnection1.Close();
       Button6.Enabled = true;
    }