ASP.net MVC数据库备份

时间:2016-06-08 12:38:37

标签: asp.net-mvc

我需要备份我的数据库,我想将该文件作为下载文件。只要您从任何网站获得某种文件,它们就会被下载。我想备份我的数据库而不设置目录。

sqlcmd = new SqlCommand("backup database test to disk='" + backupDIR + "\\" + DateTime.Now.ToString("ddMMyyyy_HHmmss") + ".Bak'", con);

在此编码中,它设置备份目录。我想通过浏览器将该文件作为下载文件获取。
如何实现这一目标?

2 个答案:

答案 0 :(得分:0)

试试这个

Private Sub Command56_Click()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String
Set db = CurrentDb()
   Set qdf = db.QueryDefs("z_Basis_QSReport5_Proposal Details_For_Report")
For Each varItem In Me!SelectTime.ItemsSelected
  strCriteria = strCriteria & ",'" & Me!SelectTime.ItemData(varItem) & "'"
Next varItem
If Len(strCriteria) = 0 Then
  MsgBox "You did not select anything from the list" _
         , vbExclamation, "Nothing to find!"
  Exit Sub
   End If
   strCriteria = Right(strCriteria, Len(strCriteria) - 1)
   strSQL = "SELECT * FROM z_Basis_QSReport5_Proposal Details " & _
            "WHERE z_Basis_QSReport5_Proposal Details.CriteriaFY IN(" &           strCriteria & ");"
   qdf.SQL = strSQL
   DoCmd.OpenQuery "z_Basis_QSReport5_Proposal Details_For_Report"
   Set db = Nothing
   Set qdf = Nothing
End Sub

来自here

答案 1 :(得分:0)

double