• 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++无需创建实例而访问类成员函数
    Why do I get "Value computed is not used" when working with pointers?
    指针数组以及指向字符串的理解
    彻底了解指针数组,数组指针,以及函数指针,以及堆中的分配规则
    结构体(struct) 的 sizeof 大小
    C语言深入学习系列 字节对齐&内存管理
    C语言字节对齐详解
    poj2945
    poj2110
  • 原文地址:https://www.cnblogs.com/tatsuya/p/1787354.html
Copyright © 2020-2023  润新知