zoukankan      html  css  js  c++  java
  • vb.net sqlserver

    Dim   strcon   As   String
                    Dim   strsql   As   String
                    Dim   con   As   SqlConnection
                    Dim   com   As   SqlCommand
                    Dim   databasepath   As   String
                    Dim   pos   As   Integer

                    databasepath   =   Application.ExecutablePath
                    pos   =   InStrRev(databasepath,   "\ ")
                    databasepath   =   Mid(databasepath,   1,   pos)   &   "backup\databaseback.bak "
                   
                    strcon   =   "server=localhost;database=humanadministration;uid=cxl;pwd=cxl; "
                    con   =   New   SqlConnection(strcon)
                    strsql   =   "backup   database   yourdatabase   to   disk= ' "   &   databasepath   &   " ' "
                    com   =   New   SqlCommand(strsql,   con)

                    Try

                            con.Open()
                            com.ExecuteNonQuery()
                            MessageBox.Show( "数据库备份成功! ",   "信息提示: ",   MessageBoxButtons.OK,   MessageBoxIcon.Information)

                    Catch   ex   As   Exception
                            MessageBox.Show(ex.Message,   "错误提示: ",   MessageBoxButtons.OK,   MessageBoxIcon.Exclamation)
                    Finally
                            con.Close()
                    End   Try

  • 相关阅读:
    C#常用笔记.cs
    OpenFileDialog 和 FolderBrowserDialog
    C#双缓存.cs
    数据库设计范式
    js 给你一个 32 位的有符号整数 x ,返回将 x 中的数字部分反转后的结果
    Study Plan The Sixth Day
    Study Plan The First Day
    Study Plan The Seventh Day
    Study Plan The Second Day
    C#CustomAttribute和泛型约束 应用于经典数据处理适配
  • 原文地址:https://www.cnblogs.com/tatsuya/p/1787354.html
Copyright © 2011-2022 走看看