C# を使用して ASP.NET で次のコードを実行すると、「行/列のデータが存在しません」などの例外が発生します。
private void updateGrnItemDetails(object sender, EventArgs e)
{
txtItemNameGrnUpdate.Enabled = true;
txtItemCostGrnUpdate.Enabled = true;
txtItemColorGrnUpdate.Enabled = true;
String s = cmbGrnUpdateItemCode.SelectedItem.ToString();
MessageBox.Show(s);
sqlQuery2 = @"SELECT * FROM item WHERE (itemType ='"+cmbGrnUpdateItemType.SelectedText+"')";
comm = new SqlCeCommand(sqlQuery2, con_data);
try
{
con_data.Open();
dr = comm.ExecuteReader();
MessageBox.Show(dr.GetString(0));
while (dr.Read())//reading data from rows
{
txtItemNameGrnUpdate.Text += dr["itemName"].ToString();
txtItemColorGrnUpdate.Text += dr["itemColor"].ToString();
txtItemCostGrnUpdate.Text += dr["itemCost"].ToString();
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
con_data.Close();
}
}
Visual Studio 2010 と Sql Compact エディションを使用しています。これを解決する方法を教えてください。