I'm trying to get a parameter with this function...
public static int subsumer(string id,int acc,SqlConnection connection)
{
acc++;
SqlCommand cercas = new SqlCommand("select * from common_relation where id_source ='" + id + "' AND type='@' ", connection);
SqlDataReader leggsyn = null;
leggsyn = cercas.ExecuteReader();
int f = 0;
while (leggsyn.Read())
{
f= subsumer(leggsyn["id_target"].ToString(),acc,connection);
if (acc <= f)
{
acc = f;
}
}
//siamo arrivati alla fine
return acc-1;
}
each cycle the parameter acc will increment and debugging i see that in my case it reach value 3, but in the final recursion i get always 0...i can't get it...thank you all
parameter? Also why are you using string concatenation instead of using a proper parameterized query? A single weird character in your inputs will cause problems. More interesting input may be1;DROP TABLE COMMON_RELATION;--