0

如果这被问了 10000 次,我真的很抱歉,但我找不到任何关于它的信息。

我正在将数据库表的备份副本从开发站点复制到实时站点,并且我正在使用此代码来执行此操作,但我还有另外 10 个表要复制,我确定一定有更简单的方法吗?

Dim AccessConn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../../_db/db.mdb") & "")
AccessConn.Open()
Dim AccessCommand As New System.Data.OleDb.OleDbCommand("DELETE * FROM news", AccessConn)
AccessCommand.ExecuteNonQuery()
Dim AccessCommand2 As New System.Data.OleDb.OleDbCommand("INSERT INTO news SELECT * FROM news_dev WHERE isapproved", AccessConn)
AccessCommand2.ExecuteNonQuery()
Response.Write("News Updated")
Response.Write("<br />")

Dim AccessCommand3 As New System.Data.OleDb.OleDbCommand("DELETE * FROM pages", AccessConn)
AccessCommand3.ExecuteNonQuery()
Dim AccessCommand4 As New System.Data.OleDb.OleDbCommand("INSERT INTO pages SELECT * FROM pages_dev WHERE isapproved", AccessConn)
AccessCommand4.ExecuteNonQuery()
Response.Write("Pages Updated")
Response.Write("<br />")

AccessConn.Close()
4

0 回答 0