Unreachable code detected

Posted by habbo95 on Stack Overflow See other posts from Stack Overflow or by habbo95
Published on 2010-05-24T16:59:43Z Indexed on 2010/05/24 17:21 UTC
Read the original article Hit count: 154

Filed under:

Hi all,

I'm getting a "Unreachable code detected" message in Visual Studio at the point con.close() in my code below. Can you spot what I've done wrong?

Thanks

private int chek1(String insert)
{
    OleDbConnection con = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=d:\\sdb.mdb");
    OleDbCommand com = new OleDbCommand("select count(*) from sn where sn='" + insert + "\'", con);           
    con.Open();

    int po = (int)com.ExecuteScalar();           
    if (po > 0)
        return 1;
    else
        return 0;
    con.Close();    
}

© Stack Overflow or respective owner

Related posts about c#