I'm using .net core 2.2 and some users having this problem:
My API code is below:
var dt = ktd.LIST_VC_TUITHU_NOUSE_BCS(data.loai_taikien, data.noi_den, data.ma_tuithu, user.ma_buucuc, user.userid);
List<object> lstBK = new List<object>();
if (dt.Rows.Count != 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
var bk = new
{
id_tuithu = dt.Rows[i]["ID_TUITHU"].ToString(),
ma_tuithu = dt.Rows[i]["MA_TUITHU"].ToString(),
loai_tt = dt.Rows[i]["LOAI_TT"].ToString(),
chuyenxe_den = dt.Rows[i]["CHUYENXE_DEN"].ToString(),
loai_nhap_xuat = dt.Rows[i]["LOAI_NHAP_XUAT"].ToString(),
trang_thai = dt.Rows[i]["TRANG_THAI"].ToString(),
ma_buucuc_di = dt.Rows[i]["MA_BUUCUC_DI"].ToString(),
ma_buucuc_den = dt.Rows[i]["MA_BUUCUC_DEN"].ToString(),
ma_buucuc = dt.Rows[i]["MA_BUUCUC"].ToString(),
ma_chuyenthu = dt.Rows[i]["MA_CHUYENTHU"].ToString(),
so_luong = dt.Rows[i]["SO_LUONG"].ToString(),
trong_luong = dt.Rows[i]["TRONG_LUONG"].ToString(),
ghi_chu = dt.Rows[i]["GHI_CHU"].ToString(),
ngay_nhap_may = dt.Rows[i]["NGAY_NHAP_MAY"].ToString(),
nguoi_nhap_may = dt.Rows[i]["NGUOI_NHAP_MAY"].ToString(),
id_chuyenthu = dt.Rows[i]["ID_CHUYENTHU"].ToString(),
stt = dt.Rows[i]["STT"].ToString(),
username = dt.Rows[i]["USERNAME"].ToString(),
loai_hang_hoa = dt.Rows[i]["LOAI_HANG_HOA"].ToString(),
loai_dichvu = dt.Rows[i]["LOAI_DICHVU"].ToString(),
loai_hh = dt.Rows[i]["LOAI_HH"].ToString(),
vung_di = dt.Rows[i]["VUNG_DI"].ToString(),
vung_den = dt.Rows[i]["VUNG_DEN"].ToString(),
ten_tinh_den = dt.Rows[i]["TEN_TINH_DEN"].ToString(),
ma_tinh_den = dt.Rows[i]["MA_TINH_DEN"].ToString(),
};
lstBK.Add(bk);
}
}
In Oracle DB, I had it returned all columns with names I defined.
And it works normally with most of users. Only some users tell me they got this annoying "Specified cast is not valid" message.
What I have tried:
I asked an user for his account information and query the data that my API calls to OracleDB. And as I thought, data was there. All DB columns' names match my API's requirement. I cannot debug the API in the production environment and cannot export data to the development environment to debug, too.
Could anyone helps me with this problem ?