欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

vb.net還原數(shù)據(jù)庫(kù),vbios還原

vb.net 怎么操作數(shù)據(jù)庫(kù)

如果樓主熟悉VB6,可以直接在項(xiàng)目中添加ADODB的Com引用,這樣你就可以像VB6那樣操作數(shù)據(jù)庫(kù)了!

網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、重慶小程序開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了班瑪免費(fèi)建站歡迎大家使用!

另外

.NET Framework中連接數(shù)據(jù)庫(kù)要用到ADO.NET。如果要操作Access數(shù)據(jù)庫(kù),要用到System.Data.OleDb命名空間下的許多類。

比如按樓主所說,“我想在textbox1中顯示表一中【一些數(shù)據(jù)】字段下的第一個(gè)內(nèi)容”:

'首先導(dǎo)入命名空間

Imports System.Data

Imports System.Data.OleDb

'然后在某一個(gè)事件處理程序中寫:

Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=數(shù)據(jù)庫(kù).accdb;Jet OLEDB:Database Password=MyDbPassword")

Dim command As New OleDbCommand("Select * From 數(shù)據(jù)表", conn)

conn.Open() '打開數(shù)據(jù)庫(kù)連接

Dim reader As OleDbDataReader = command.ExecuteReader() '執(zhí)行SQL語(yǔ)句,返回OleDbDataReader 對(duì)象

Do While reader.Read() '讀取一條數(shù)據(jù)

textbox1.Text += reader("一些數(shù)據(jù)") VbCrLf

Loop

reader.Close() '關(guān)閉OleDbDataReader

conn.Close() '關(guān)閉連接

VB.NET 怎么調(diào)用備份恢復(fù)SQL2008 數(shù)據(jù)庫(kù)?求源碼。。

引用Microsoft SQLDMO Object Library

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim SQLSER As New SQLDMO.SQLServer

SQLSER.Connect(ServerName, UserName, PassWord) '這三項(xiàng)換為你自己的

PBackup.Database = DatabaseName '數(shù)據(jù)庫(kù)名

Me.Cursor = System.Windows.Forms.Cursors.WaitCursor

Dim PathName As String

PathName = "D:\BackUp"

PBackup.Files = PathName

PBackup.SQLBackup(SQLSER)

SQLSER.DisConnect()

SQLSER = Nothing

Me.Cursor = System.Windows.Forms.Cursors.Default

MsgBox("成功備份了數(shù)據(jù)")

End Sub

VB.NET備份SQL數(shù)據(jù)庫(kù)

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.IO;

using System.Text;

using _5dRss.Const;

using _5dRss.lib.Data.Tool;

public partial class admin_admin_dbmanage : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

//生成備份文件列表

ListBackupFiles();

if (!Page.IsPostBack)

{

Showmsg.Visible = false;

//數(shù)據(jù)庫(kù)路徑

lilDBPath.Text = HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"];

//新建一個(gè) FileInfo 對(duì)象,并獲得數(shù)據(jù)庫(kù)文件的大小,然后轉(zhuǎn)換單位為KB

FileInfo myFileInfo = new FileInfo(lilDBPath.Text);

lilDBSize.Text = Convert.ToString(myFileInfo.Length/1024) + " KB";

//如果兩個(gè)參數(shù)都不為空,則繼續(xù)執(zhí)行

if (Request.QueryString["cmd"] != null Request.QueryString["source"] != null)

{

//備份數(shù)據(jù)庫(kù)原文件名

string sourceFileName = Request.QueryString["source"];

//如果 cmd 參數(shù)為 DelFile

if (Request.QueryString["cmd"].Equals("DelFile"))

{

//刪除備份數(shù)據(jù)庫(kù)文件

File.Delete(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\" + sourceFileName);

//刷新備份文件列表

ListBackupFiles();

Showmsg.Visible = true;

Showmsg.Text = "div align='center' style='margin-bottom:8px;'img src='images/aL.gif' style='margin-bottom:-6px;'/span class='alertTxt'刪除備份數(shù)據(jù)庫(kù)成功!/spanimg src='images/aR.gif' style='margin-bottom:-6px;'//div";

}

//如果 cmd 參數(shù)為 Restore

if (Request.QueryString["cmd"].Equals("Restore"))

{

//用備份文件覆蓋原文件

File.Copy(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\" + sourceFileName, HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"], true);

//刷新備份文件列表

ListBackupFiles();

Showmsg.Visible = true;

Showmsg.Text = "div align='center' style='margin-bottom:8px;'img src='images/aL.gif' style='margin-bottom:-6px;'/span class='alertTxt'還原備份數(shù)據(jù)庫(kù)成功!/spanimg src='images/aR.gif' style='margin-bottom:-6px;'//div";

}

}

}

}

protected void lnkbtnCompactDB_Click(object sender, EventArgs e)

{

//壓縮修復(fù)數(shù)據(jù)庫(kù)

AccessDBtool.CompactAccessDB(SysConfig.ConnectionString, HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"]);

Showmsg.Visible = true;

Showmsg.Text = "div align='center' style='margin-bottom:8px;'img src='images/aL.gif' style='margin-bottom:-6px;'/span class='alertTxt'壓縮修復(fù)數(shù)據(jù)庫(kù)成功!/spanimg src='images/aR.gif' style='margin-bottom:-6px;'//div";

}

protected void lnkbtnBackupDB_Click(object sender, EventArgs e)

{

string sourceFileName = HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"];

string destFileName = HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\" + "Backup_";

destFileName += DateTime.Now.ToString("yyyyMMddHHmmss");

destFileName += ".mbk";

//將數(shù)據(jù)庫(kù)文件Copy到Backup目錄,如果有重名文件就覆蓋原文件

File.Copy(sourceFileName, destFileName, true);

//生成備份文件列表

ListBackupFiles();

Showmsg.Visible = true;

Showmsg.Text = "div align='center' style='margin-bottom:8px;'img src='images/aL.gif' style='margin-bottom:-6px;'/span class='alertTxt'備份數(shù)據(jù)庫(kù)成功!/spanimg src='images/aR.gif' style='margin-bottom:-6px;'//div";

}

/// summary

/// 生成備份文件列表

/// /summary

/// returns文件列表,文件詳細(xì)信息及操作選項(xiàng)的HTML代碼/returns

public void ListBackupFiles()

{

//如果目錄不存在則創(chuàng)建次目錄

if (!Directory.Exists(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\"))

Directory.CreateDirectory(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\");

DirectoryInfo mydir = new DirectoryInfo(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\");

StringBuilder sb = new StringBuilder();

foreach (FileInfo f in mydir.GetFiles())

{

sb.Append("a href='backup/" + f.Name + "' target='_blank'img border='0' src='images/mdb.gif' style='margin:4px 3px -3px 0px'/" + f.Name + "/a a href='?cmd=DelFilesource=" + f.Name + "' title='刪除備份文件'刪除/a | a href='?cmd=Restoresource=" + f.Name + "' title='刪除備份文件'還原數(shù)據(jù)庫(kù)/a | " + f.Length/1024 + " KB | " + f.CreationTime + "br /");

}

lilBackupFileList.Text = sb.ToString();

}

}

把下面這句換成你的數(shù)據(jù)庫(kù)地址:

//數(shù)據(jù)庫(kù)路徑

// lilDBPath.Text = HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"];

VB.NET,將數(shù)據(jù)從dataset中刪除了,如何更新到數(shù)據(jù)庫(kù)?

需要聲明使用CommandBuilder對(duì)象,你是 SQL 數(shù)據(jù)庫(kù)還是 ACCESS 數(shù)據(jù)庫(kù),這兩者的對(duì)象不一樣的。

對(duì)于:SQL server

Dim Mybuilder As SqlCommandBuilder = New SqlCommandBuilder(da)

da.Update(dt) '使用Update方法實(shí)現(xiàn)更新到數(shù)據(jù)庫(kù)

對(duì)于:ACCESS

Dim Mybuilder As OleDbCommandBuilder = New OleDbCommandBuilder(da)

da.Update(dt) '使用Update方法實(shí)現(xiàn)更新到數(shù)據(jù)庫(kù)

關(guān)于vb.net上數(shù)據(jù)庫(kù)的使用問題

你把數(shù)據(jù)庫(kù)中的數(shù)據(jù)查詢出來保存在DataSet 中

DataSet 是脫機(jī)的數(shù)據(jù)集,也即與數(shù)據(jù)庫(kù)斷開的數(shù)據(jù)集

把DataSet綁定到GridView上,這時(shí)候你在GridView上的操作就都是與數(shù)據(jù)庫(kù)斷開的

當(dāng)前題目:vb.net還原數(shù)據(jù)庫(kù),vbios還原
新聞來源:http://chinadenli.net/article6/heihog.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、響應(yīng)式網(wǎng)站、面包屑導(dǎo)航、App設(shè)計(jì)品牌網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

綿陽(yáng)服務(wù)器托管