Skip to content

"Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done." error when combobox selected index changed

Nel

Asked Feb 8, 2012, 12:30 AM EST1 answer
Share
LinkedInX
Hi,

Can anybody help me please how to solve this problem: When selecting a value from the combobox I got an error "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."

Here is my code for the event:

private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
  {
  DataSet3 _dataset = new DataSet3();
  OleDbCommand com1 = new OleDbCommand();
  com1.Connection = conn;
  com1.CommandText = "Select * from Dogovor where Komint=? order by Brdog";
  com1.Parameters.AddWithValue("@Komint", comboBox3.SelectedValue);
  OleDbDataAdapter oleDBDataAdapter1 = new OleDbDataAdapter(new OleDbCommand(com1.CommandText, conn));
  try
  {
  //conn.Open();
  com1.ExecuteNonQuery();
  comboBox2.DataSource = _dataset.Tables["Dogovor"];
  comboBox2.DisplayMember = "Brdog";
 
 / oleDBDataAdapter1.Fill(_dataset, "Komint");
  }
 
  finally
  {
  conn.Close();
  }
  textBox1.Focus();
  }

Thank you very much in advance.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Suthish Nair
    0
    If the thread still not resolved try this..

    string connectionString = "your connection string";
    string sql = "Select * from Dogovor where Komint=? order by Brdog";

    OleDbConnection oledbConn1 = new OleDbConnection(connetionString);
    oledbConn1.Open();

    DataSet dsRecords = new DataSet();
    OleDbDataAdapter oleDBDataAdapter1 = new OleDbDataAdapter(sql, oledbConn1);
    oledbAdapter.Fill(dsRecords);

    if(dsRecords.Tables[0].Rows.Count > 0)
    {
    comboBox2.DataSource = dsRecords.Tables["Dogovor"];
    comboBox2.DisplayMember = "Brdog";
    }

    oledbAdapter.Dispose();
    oledbCnn.Close();

    0