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++ 长指针与指针的区别
    C# WinForm 控件光标
    不错的UML建模工具StarUML
    给控件做数字签名之一:将控件打包为Web发布包(转)
    MsComm控件注册失败
    微软发布Microsoft图表控件
    C与C++中的宏
    WinForm DataGridView 显示行号
    C#ToString格式大全
  • 原文地址:https://www.cnblogs.com/tatsuya/p/1787354.html
Copyright © 2011-2022 走看看