110,534
社区成员
发帖
与我相关
我的任务
分享
public string[] DataFileNames
{
set
{
string[] mdbFiles = value;
foreach (string filename in mdbFiles)
{
mdbFile = filename;
string strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename;
global::Analyze.Properties.Settings.Default["DataTempletNewConnectionString"] = strConnectionString;
//this.vehicleDataTableAdapter.Connection.Close();
this.vehicleDataTableAdapter.Connection.ConnectionString = strConnectionString;
try
{
this.vehicleDataTableAdapter.Fill(this.dataTempletNewDataSet.VehicleData);
}
catch (ConstraintException)
{
//05-08异常,WXH
}
vehicleDataBindingSource.Sort = "PassTime desc";
string strSQL;
OleDbDataAdapter adapter;
DataTable dt;
strSQL = "select Site from SiteData";
adapter = new OleDbDataAdapter(strSQL, strConnectionString);
dt = new DataTable();
adapter.Fill(dt);
if (dt.Rows.Count != 0)
{
label_site.Text= dt.Rows[0]["Site"].ToString();
}
else
{
label_site.Text = "";
}
strSQL = "select UserName from Users";
adapter = new OleDbDataAdapter(strSQL, strConnectionString);
dt = new DataTable();
adapter.Fill(dt);
if (dt.Rows.Count != 0)
{
label_user.Text = dt.Rows[0]["UserName"].ToString();
}
else
{
label_user.Text = "";
}
int i = Text.IndexOf(" - ");
if (i > 0)
Text = Text.Substring(0, i);
Text += " - " + filename;
comboBox_DeviceID.SelectedIndex = 0;
}
}
}