1 新建数据库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
string path = AppDomain.CurrentDomain.BaseDirectory + "\\test.mdb";
ADOX.CatalogClass catalog = new ADOX.CatalogClass();
try
{
string connectionStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Jet OLEDB:Database Password=admin123;Jet OLEDB:Engine Type=5;";
object v = catalog.Create(connectionStr);
//OleDbConnection conn = new OleDbConnection(connectionStr);
//conn.Open();
//conn.Close();
}
catch(Exception ex)
{
throw ex;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
insert into [表名](字段名) values('字段值')

delete from [表名] where [字段名]='字段值'

update [表名] set [字段名]=字段值 where [字段名]='字段值'

SELECT [字段名] FROM [表名]


alter table [表名] add column [字段名] 字段类型

alter table [表名] drop column [字段名]

alter table [表名] add primary key(字段名)

alter table [表名] drop primary key(字段名)


create table [表名]([字段名] 字段类型 [not null] [primary key],[字段名] 字段类型 [not null],..)

)