I have 2 Tables. I want to get all ID's from Table1, and while I am inside the frist OleDbCommand I want to check if the ID is in Table2 too. I tried this:
using (OleDbCommand cmd = new OleDbCommand("SELECT ID FROM Table1 WHERE NAME=:NAME)
{
............
decimal dId = (decimal)odr["ID"];
using (OleDbCommand cmdE = new OleDbCommand("SELECT LOGID FROM Table2 WHERE ID:=ID", con))
cmdE.CommandType = CommandType.Text;
cmdE.Parameters.Add(new OleDbParameter("ID", dId));
decimal cId=-1;
using (OleDbDataReader odrE = cmdE.ExecuteReader())
{
while (odrE.Read())
{
cId = (decimal)odrE["ID"];
}...............
The Problem is that
cId = (decimal)odrE["ID"];
is never executed, even though if I do a manaul Select inside the Sql Developer i get results. What am I doing wrong?