str=
@"RESTORE DATABASE tDB  FROM DISK ='D:\tDB.dll' 
With Move 'tDB_dat' to 'C:\tDB.mdf',
Move 'tDB_log' to 'C:\tDB_log.ldf' ";

解决方案 »

  1.   


    SqlConnection Conn = new SqlConnection("连接字符串");
    SqlCommand Cmd = Conn.CreateCommand();
    Cmd.CommandText = @"RESTORE DATABASE tDB  FROM DISK ='D:\tDB.dll' With Move 'tDB_dat' to 'C:\tDB.mdf', Move 'tDB_log' to 'C:\tDB_log.ldf' ";Conn.Open();
    Cmd.ExecuteNonQuery();
    Conn.Close();
    这样?
      

  2.   

    同上:str= @"RESTORE DATABASE tDB  FROM DISK ='D:\tDB.dll' With Move 'tDB_dat' to 'C:\tDB.mdf', Move 'tDB_log' to 'C:\tDB_log.ldf' ";
    SqlConnection Conn = new SqlConnection("连接字符串");
    SqlCommand Cmd = new SqlCommand(str,Conn);
    Conn.Open();
    Cmd.ExecuteNonQuery();
    Conn.Close();
      

  3.   

    str= @"RESTORE DATABASE tDB  FROM DISK ='D:\tDB.dll' With Move 'tDB_dat' to 'C:\tDB.mdf', Move 'tDB_log' to 'C:\tDB_log.ldf' ";
    SqlConnection Conn = new SqlConnection("连接字符串");
    SqlCommand Cmd = new SqlCommand(str,Conn);
    Conn.Open();
    Cmd.ExecuteNonQuery();
    Conn.Close();
      

  4.   

    http://www.cnblogs.com/icwin/articles/1285657.html
    http://www.cnblogs.com/hopeless/archive/2008/08/21/1273469.html