0
在我的自定義代碼中執行簡單的select語句時出現以下錯誤。 找不到的結果指定列在MySQL中的結果中找不到指定的列
這裏是我的代碼 -
string queryBuilder="select BASKET_DESCRIPTION from MARKET_BASKET_REQUESTS order by BASKET_DESCRIPTION limit 1";
public T SelectSingle<T>(string queryBuilder) where T : new()//made new
{
T result = new T();
TableScheme dbTable = GetTableSchemeFromType(typeof(T));
IDataReader reader = ExecuteReader(queryBuilder);
result = ParseDataReaderToEntityListtttt<T>(reader,dbTable);
reader.Close();
return result;
}
private T ParseDataReaderToEntityListtttt<T>(IDataReader reader, TableScheme dbTable) where T : new()
{
Type type = typeof(T);
T result = new T();
while (reader.Read())
{
T t = new T();
foreach (var column in dbTable.Columns)
{
type.GetProperty(column.AssociatedPropertyName).SetValue(t, reader[column.ColumnName], null);
}
result = t;
}
return result;
}
GetTableSchemeFromType的代碼是什麼?哪一行代碼給你錯誤? –