I have done some thing similar,in making DB configuration of an application and its working fine,hope it'll help you
private bool Test()
{
bool rvalue = false;
string cnstr = @"Data Source=" + dbnametxt.Text + ";Initial Catalog=DBname;Integrated Security=True";
string sqlcnstr = @"Data Source=" + dbnametxt.Text + ";Initial Catalog=DBname;uid=" + uidtxt.Text + ";pwd=" + pwdtxt.Text + ";";
if (radioButton1.Checked)
{
}
else if (radioButton2.Checked)
{
}
if (conn.OpenCon())
{
rvalue = false;
}
else
{
rvalue = true;
}
return rvalue;
}