假如控件在Panel里面

程序代码:
try
{
foreach (Control ct in this.panel1.Controls)
{
if (ct is RadioButton && (ct as RadioButton).Checked)
{
using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection("连接字符串"))
{
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("insert into ...", con);
con.Open();
if (cmd.ExecuteNonQuery() > 0)
{
MessageBox.Show("OK");
}
else
{
MessageBox.Show("失败", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
con.Close();
}
return;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}