/// <summary>
/// 创建一个Access数据库对象.
/// </summary>
private void BulidAccess()
{
try
{
ADOX.CatalogClass Cat = new ADOX.CatalogClass();
string DataBaseName=this.BuildName()+".mdb";
this.DesDataBase+=DataBaseName;
CreateText="Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + this.DesDataBase + ";" +
"Jet OLEDB:Engine Type=5";
Cat.Create(CreateText);
}
catch(Exception e)
{
MessageBox.Show(e.Message.ToString(),"消息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
/// <summary>
/// 在新创建的数据库中创建表
/// </summary>
private void BuildTable()
{
try
{
this.OleCnnDes = new OleDbConnection(this.CreateText);
this.OleCnnDes.Open();
string SqlCreeate="Create table data(TestTime time,RunTime integer,HPV integer,DHPV integer,RPV integer,DRPV integer,LPV integer,DLPV integer)";
OleDbCommand OleCmm=new OleDbCommand(SqlCreeate,this.OleCnnDes);
OleCmm.ExecuteNonQuery();
}
catch(Exception e)
{
MessageBox.Show(e.Message.ToString(),"消息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}