/// <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); 
   }
   
  }
 
上一篇:c#中用sql语句创建表中默认值与sql server之不同
下一篇:电脑开机鸣叫
相关新闻
- 小程序登录流程图理解 2020-08-18
- 在C#中获取web.config中的配置信息 2021-08-23
- 小程序open-data头像样式 2021-04-10
- 小程序rich-text 富文本解析图片过大和图片路径的问题 2020-11-25
- C#中去掉字符串的最后一个字符 2020-11-23
 
                 
                                                 
                                                 
                                                 
                                                 
                                                 
                                                 
                                                 
                                                 
                                                 
                                                 
                                                 
                                                 
                                                 
                                                
 
                        
                    
