以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]怎么用SQL语句RESTORE FILELISTONLY获取LogicalName内容 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=98371) |
-- 作者:zwjfx -- 发布时间:2017/3/28 18:58:00 -- [求助]怎么用SQL语句RESTORE FILELISTONLY获取LogicalName内容 RESTORE FILELISTONLY FROM DISK = N\'C:\\Users\\WU\\Desktop\\TSBF20170328120216.bak\' Dim cmd As new SQLCommand \'查询名称 cmd.C cmd.CommandText &= "use master" & vbcrlf cmd.CommandText &= "restore filelistonly from disk=\'C:\\Users\\WU\\Desktop\\TSBF20170328120216.bak\'" & vbcrlf MessageBox.show(cm.ExecuteScalar())可以得到第一行的名称,那第二行的要怎么获取 |
-- 作者:有点蓝 -- 发布时间:2017/3/28 20:58:00 -- Dim cnn_char = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=数据库名称;Data Source=." Dim conn = new System.Data.SqlClient.SqlConnection(cnn_char) conn.Open() Dim cmd = conn.CreateCommand() cmd.CommandText = "use master;RESTORE FILELISTONLY FROM DISK = N\'C:\\Users\\WU\\Desktop\\TSBF20170328120216.bak\';" Dim dataset As new system.data.DataSet() Dim adapter = new System.Data.SqlClient.SqlDataAdapter(cmd) adapter.Fill(dataset) Dim dt = dataset.Tables(0) conn.Close Output.Show(dt.Rows(0)(0)) Output.Show(dt.Rows(1)(0))
|
-- 作者:zwjfx -- 发布时间:2017/3/29 10:35:00 -- |