S
Steve Bering
I am a csharp newbie and am trying to work through some code and have gotten
myself stuck in a loop. Any help would be appreciated.
I have the following code in place:
public IDcCommand GetCommand(EnumProviders provider)
{
switch( provider )
{
case EnumProviders.ODBC:
return new OdbcCommand();
case EnumProviders.SQLClient:
return new SqlCommand();
case EnumProviders.OLEDB():
return new OleDbCommand();
}
}
If I leave the code as is, I get the error "Control cannot fall through from
one case label ('case 0:') to another". If I change each case to add a break
after the return line, then I get an unreachable code detected error. How
can I get this code to work? I thought a return was supposed to a value exit
from a fall through. Any help would be most appreciated.
Thanks,
Steve Bering
myself stuck in a loop. Any help would be appreciated.
I have the following code in place:
public IDcCommand GetCommand(EnumProviders provider)
{
switch( provider )
{
case EnumProviders.ODBC:
return new OdbcCommand();
case EnumProviders.SQLClient:
return new SqlCommand();
case EnumProviders.OLEDB():
return new OleDbCommand();
}
}
If I leave the code as is, I get the error "Control cannot fall through from
one case label ('case 0:') to another". If I change each case to add a break
after the return line, then I get an unreachable code detected error. How
can I get this code to work? I thought a return was supposed to a value exit
from a fall through. Any help would be most appreciated.
Thanks,
Steve Bering