Should I use ExecuteNonQuery for this db backup command

后端 未结 8 875
迷失自我
迷失自我 2021-01-17 03:26

I have a method that allows me to kick off a back up of a data base. What I am wondering is if I should be using ExecuteNonQuery() in this context or if there is something

8条回答
  •  借酒劲吻你
    2021-01-17 04:04

    Try it. it resolved timeout expired problem while large size db.

    Private Sub Command1_Click() On Error Resume Next Dim con As New Connection Dim tm As String con.CommandTimeout = 500'''Command timeout should be 500

    With con .ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=dbiBMS;Data Source=192.168.103.4" .Open End With tm = CStr(Time)

    con.Execute " backup database dbiBMS to disk='E:\Database_Backup\Test1.bak' with format "

    con.Close MsgBox tm Exit Sub x: MsgBox Err.Description

    End Sub

提交回复
热议问题