access数据库
//访问动态创建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, -1); 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 = 9; column.Properties["AutoIncrement"].Value = true; table.Columns.Append(column, ADOX.DataTypeEnum.adInteger, 0); table.Columns.Append("ClassbId", DataTypeEnum.adInteger, 0); table.Columns.Append("ClassbName", DataTypeEnum.adVarWChar, 51); table.Columns.Append("Gid", DataTypeEnum.adInteger, 0); table.Columns.Append("HotalId", DataTypeEnum.adInteger, 0);
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。