0
데이터베이스를 만들었습니다. IMEI 필드가 있습니다. 콤보 상자에 드롭 다운 목록으로 데이터를 제안하려고했습니다. 그러나 나는 실패했다. 이 코드를 수정하도록 도와주세요. 이 오류를 어떻게 수정합니까?내 코드에서이 오류를 수정하는 방법. " 'System.Data.OleDb.OleDbDataReader'형식에 정의 된 생성자가 없습니다."
Private void Autocomplete()
{
OleDbConnection con = new
OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;DataSource=|DataDirectory|/Neth1.accdb");
con.Open();
string sql = "SELECT IMEI FROM Products";
OleDbCommand comm = new OleDbCommand(sql, con);
OleDbDataReader reader = new OleDbDataReader();
reader = comm.ExecuteReader();
AutoCompleteStringCollection autocomp = new AutoCompleteStringCollection();
while (reader.Read())
{
comboBox1.AutoCompleteMode = AutoCompleteMode.Suggest;
comboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
comboBox1.AutoCompleteCustomSource = autocomp;
}
reader.Close();
con.Close();
}
는 기본 생성자와 OleDbDataReader', 당신이 직접 사용할 수있는'초기화 할 필요가 없습니다 :'방법 OleDbDataReader 독자 = comm.ExecuteReader(); '. –