我有一份每周更新的报告,需要推送到 30 多台 PC,而且这个数字每周都在增加。我试图弄清楚如何获取 Access 数据库并将文件从我们服务器上的某个位置推送到所有这些 PC,但我无法理解如何去做。我打算使用复制命令,然后在字符串中使用 PC ID 的值并将其输入到文件路径中。这比我习惯使用的要先进一点。这是我到目前为止所拥有的:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'database1DataSet1.PCID_List' table. You can move, or remove it, as needed.
this.pCID_ListTableAdapter.Fill(this.database1DataSet1.PCID_List);
}
private void button_Close_Click(object sender, EventArgs e)
{
this.Close();
}
static void button_Run_Click(object sender, EventArgs e)
{
string reportLocationCopy = @"Location TBD";
string repLoc = @"Location TBD";
if (File.Exists(repLoc))
{
// If file already exists in destination, delete it
if (File.Exists(reportLocationCopy))
File.Delete(reportLocationCopy);
File.Copy(repLoc, reportLocationCopy);
}
}
}
}