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# 文本,图片 与 Base64的相互转换
    vue3.x 中的自定义组件及使用
    vue 的TodoList 小Demo
    vue中的条件渲染 v-show、v-if、v-else、v-else-if
    vue 使用$refs获取表单内容及v-model双向数据绑定
    python-异常处理&操作数据库&网络编程
    python-接口开发
    python-数据库&邮件
    python-函数和模块
    python-函数&list&dic&集合&文件读取
  • 原文地址:https://www.cnblogs.com/tatsuya/p/1787354.html
Copyright © 2011-2022 走看看