我收到编译时错误reader.GetString
,知道为什么吗?
代码:
using (var connection = new OleDbConnection())
{
connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Sparrow vivek\Documents\Billing.accdb";
connection.Open();
var query = "SELECT ItemCode FROM invoice";
using (var command = new OleDbCommand(query, connection))
{
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
comboBox1.Items.Add(reader.GetString("ItemCode"));
comboBox2.Items.Add(reader.GetString("ItemCode"));
}
}
}
}