asfman
android developer
posts - 90,  comments - 213,  trackbacks - 0
<job>
<script>
var oCat=new ActiveXObject('adox.catalog');
var oTbl=new ActiveXObject('adox.table');
oCat.Create("Provider=Microsoft.Jet.Oledb.4.0;Data Source=asfman.mdb");
/*
if asfman.mdb has already existed
connStr = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=asfman.mdb";
oCat.ActiveConnection=connStr
*/
with(oTbl){
  Name='iTable'; // table name
  ParentCatalog=oCat;
  Columns.Append('col1', 3); // integer
  Columns.Append('col2', 7); // date
  Columns.Append('col3', 205); // long binary
  Columns.Append('col4', 203); // memo
  Columns.Append('col5', 202); // text
  Columns.Append('col6', 130); // text
  Columns.Append('col7', 11); // boolean
  Columns.Append('col8', 6); // currency
  Columns.Append('col9', 72); // guid
    /* 创建自动编号 */
  Columns.Append('col10', 3); // integer
  Columns('col10').Properties('AutoIncrement')=true;
 }
oCat.Tables.Append(oTbl);
oTbl=null;
oCat=null; 
</script>
</job>
//id自动增加类型
<job>
<script>
var catalog = new ActiveXObject("AdoX.Catalog");
catalog.Create("Provider=Microsoft.Jet.Oledb.4.0;Data Source=asfman.mdb");
var table = new ActiveXObject("AdoX.Table");
table.ParentCatalog = catalog;
table.Name = "test";
var col = new ActiveXObject("AdoX.Column");
col.Name="id";
col.Type = 3;
table.Columns.Append(col);
col.Properties('AutoIncrement')=true;
catalog.Tables.Append(table);
</script>
</job>
或者
<job>
<script>
var catalog = new ActiveXObject("AdoX.Catalog");
catalog.Create("Provider=Microsoft.Jet.Oledb.4.0;Data Source=asfman.mdb");
var table = new ActiveXObject("AdoX.Table");
//设置parentCatalog是关键
table.ParentCatalog = catalog;
table.Name = "test";
//var col = new ActiveXObject("AdoX.Column");
//col.Name="id";
//col.Type = 3;
table.Columns.Append("id",3,0);
table.Columns("id").Properties('AutoIncrement')=true;
catalog.Tables.Append(table);
</script>
</job>
posted on 2007-11-04 23:17 汪杰 阅读(706) 评论(2)  编辑 收藏 引用

FeedBack:
# re: 创建acc数据库 表 字段
2008-05-20 22:10 | 汪杰
<job>
<script>
var oCat=new ActiveXObject('adox.catalog');
var oTbl=new ActiveXObject('adox.table');
oCat.Create("Provider=Microsoft.Jet.Oledb.4.0;Data Source=create.mdb");
with(oTbl){
Name='Customers'; // table name
ParentCatalog=oCat;
Columns.Append('id', 3); // integer
Columns('id').Properties('AutoIncrement')=true;
Columns.Append('area', 202, 150); // memo
Columns.Append('company', 202, 250); // memo
Columns.Append('type', 202, 150); // memo
}
oCat.Tables.Append(oTbl);
WSH.Echo("OK");
oTbl=null;
oCat=null;
</script>
</job>  回复  更多评论
  
# re: 创建acc数据库 表 字段
2008-05-20 22:24 | 汪杰
<job>
<script>
var oConn = new ActiveXObject("Adodb.Connection");
oConn.Open("Provider=Microsoft.Jet.Oledb.4.0; Data Source=customer2.mdb");
oConn.Execute("create table asfman(id counter IDENTITY PRIMARY KEY, name varchar(10))");
WSH.Echo("OK");
oConn.Close();
oConn=null;
</script>
</job>  回复  更多评论
  
只有注册用户登录后才能发表评论。

<2006年7月>
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345

常用链接

留言簿(15)

随笔分类(1)

随笔档案(90)

文章分类(727)

文章档案(712)

相册

收藏夹

http://blog.csdn.net/prodigynonsense

友情链接

最新随笔

搜索

  •  

积分与排名

  • 积分 - 456701
  • 排名 - 6

最新随笔

最新评论

阅读排行榜

评论排行榜