服務熱線
153 8323 9821
/// <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);
}
}
下一篇:電腦開機鳴叫