access数据库

时间:2021-06-19 17:01:37
   //访问动态创建access数据库
string conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("/Catering/") + ".accdb"; //string conn = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=F:/asp.net/MvcMovie/Access5;Jet OLEDB:Database Password=7958145;Jet OLEDB:Engine Type=5";
ADOX.Catalog cata = new ADOX.Catalog();
cata.Create(conn);
ADODB.Connection cn = new ADODB.Connection();
cn.Open(conn, null, null, -);
cata.ActiveConnection = cn;
//表
ADOX.Table table = new ADOX.Table();
table.Name = "ims_tbl_bClass";
ADOX.Column column = new ADOX.Column();
column.ParentCatalog = cata;
column.Type = ADOX.DataTypeEnum.adInteger;
column.Name = "bId";
column.DefinedSize = ;
column.Properties["AutoIncrement"].Value = true;
table.Columns.Append(column, ADOX.DataTypeEnum.adInteger, );
table.Columns.Append("ClassbId", DataTypeEnum.adInteger, );
table.Columns.Append("ClassbName", DataTypeEnum.adVarWChar, );
table.Columns.Append("Gid", DataTypeEnum.adInteger, );
table.Columns.Append("HotalId", DataTypeEnum.adInteger, );