0
我正在使用訪問數據庫,當我嘗試執行此代碼時,它得到「沒有數據存在的行/列,我在Microsoft Access中執行了SQL代碼,它工作正常。C#沒有數據存在的行/列
OleDbCommand cmd1 = new OleDbCommand("SELECT SUM (adet) AS gToplam from stok_isl WHERE stok_id = @veri and tur = 'GİRİŞ'", conn);
cmd1.Parameters.AddWithValue("@veri", combo);
OleDbDataReader dr1 = cmd1.ExecuteReader();
OleDbCommand cmd2 = new OleDbCommand("SELECT SUM (adet) AS cToplam from stok_isl WHERE stok_id = @veri and tur = 'ÇIKIŞ'", conn);
cmd2.Parameters.AddWithValue("@veri", combo);
OleDbDataReader dr2 = cmd2.ExecuteReader();
Sonuc = Convert.ToDouble(dr1["gToplam"]) - Convert.ToDouble(dr2["cToplam"]);
MessageBox.Show(Sonuc.ToString());
非常感謝您的解決方案 –