When I click on listBox1, I have 2 error messages
ERROR:
There is already an open DataReader associated with Command which must be closed first
this.unitTableAdapter1.FillBy(this.dataSet_Property_Name_And_Unit_List.Unit); Line 49
ERROR:
System.ArgumentNullException: 'Value cannot be null. Parameter name: key'
catch (System.Exception ex) Line 51
///////////////////////////////////////
DataSet_Property_Name_And_Unit_List.xsd --> Right Click - -> Open --> UnitTableAdapter --> Right Click --> Configure
SELECT Property_Name, Unit_Number FROM Unit
///////////////////////////////////////
DataSet_Unit_Detail.xsd --> Right Click - -> Open --> UnitTableAdapter --> Right Click --> Configure
SELECT Unit_Number, Property_Name, Rental_Cost, Security_Deposit, Bedroom, Bathroom, Square_Feet, Status
FROM Unit WHERE (Property_Name = '@Property_Name')
ERROR:
There is already an open DataReader associated with Command which must be closed first
this.unitTableAdapter1.FillBy(this.dataSet_Property_Name_And_Unit_List.Unit); Line 49
ERROR:
System.ArgumentNullException: 'Value cannot be null. Parameter name: key'
catch (System.Exception ex) Line 51
///////////////////////////////////////
DataSet_Property_Name_And_Unit_List.xsd --> Right Click - -> Open --> UnitTableAdapter --> Right Click --> Configure
SELECT Property_Name, Unit_Number FROM Unit
///////////////////////////////////////
DataSet_Unit_Detail.xsd --> Right Click - -> Open --> UnitTableAdapter --> Right Click --> Configure
SELECT Unit_Number, Property_Name, Rental_Cost, Security_Deposit, Bedroom, Bathroom, Square_Feet, Status
FROM Unit WHERE (Property_Name = '@Property_Name')
Code for Form3.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Retrieve_Data_From_Access_With_Navigation_Button
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
private void unitBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.unitBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.dataSet_Unit_Detail);
}
private void Form3_Load(object sender, EventArgs e)
{
this.unitTableAdapter1.Fill(this.dataSet_Property_Name_And_Unit_List.Unit);
this.unitTableAdapter.Fill(this.dataSet_Unit_Detail.Unit);
}
private void fillByToolStripButton_Click(object sender, EventArgs e)
{
try
{
this.unitTableAdapter1.FillBy(this.dataSet_Property_Name_And_Unit_List.Unit);
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
this.unitTableAdapter1.FillBy(this.dataSet_Property_Name_And_Unit_List.Unit);
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
}
}
Last edited: