vform做一个数据库还原功能出错....麻烦帮帮找找原因~~急呀~
错误如图`~代码如下:
frmMain fm=new frmMain();
fm.Dispose();
try
{
bc.getcmd("use master restore database library from disk='" + this.txtRestorePath.Text.Trim().ToString() + "'");
MessageBox.Show("数据还原成功!", "提示");
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
public void getcmd(string sqlstr)
{
SqlConnection cn = this.getcon();
cn.Open();
SqlCommand cmd = new SqlCommand(sqlstr, cn);
cmd.ExecuteNonQuery();
cmd.Dispose();
cn.Close();
cn.Dispose();
}
再说我系统的所有connection 都关了...还是有错!~~