public static datatable getschematable(string connectionstring) //獲取access所有的表名;
);return schematable;}}
private string gettabelname(string conn) //獲取access檔案中所有表名,放在陣列裡面
return strtable;
}private string getaccesstablefiled(string tablename, string conn) //獲取access指定表中的欄位名
", tablename);
datatable dt = new datatable();
accesshelper.executesql(sql, out dt, conn);
int count = dt.columns.count;
string filed = new string[count];
for (int i = 0; i < count; i++)
return filed;
create proc gettablestruct //獲取sqlserver2000表的結構的儲存過程
@tabname varchar(20)
asselect
表名 = case when a.colorder=1 then d.name else '' end,
字段序號 = a.colorder,
欄位名 = a.name,
主鍵 = case when exists(select 1 from sysobjects where xtype='pk' and parent_obj=a.id and name in (
select name from sysindexes where indid in(
select indid from sysindexkeys where id = a.id and colid=a.colid))) then '√' else '' end,
型別 = b.name,
占用位元組數 = a.length,
長度 = columnproperty(a.id,a.name,'precision')
from
syscolumns a
left join
systypes b
on
a.xusertype=b.xusertype
inner join
sysobjects d
on
a.id=d.id and d.xtype='u' and d.name<>'dtproperties'
left join
syscomments e
on
a.cdefault=e.id
left join
sysproperties g
on
a.id=g.id and a.colid=g.smallid
left join
sysproperties f
on
d.id=f.id and f.smallid=0
where
d.name in (@tabname) --如果只查詢指定表,加上此條件
order by
a.id,a.colorder
ASP 獲得Access表名
dimadoconn setadoconn server.createobject adodb.connection connstring driver dbq knddb06.mdb adoconn.open connstring setadoxcatalogx server.createobje...
獲取ACCESS表結構
經常有朋友問怎麼得到access的表結構。public sub gettables dim rs as new adodb.recordset dim conn as adodb.connection dim ssql as string set conn currentproject.connec...
獲取Access系統表
access 系統表 msysobjects 包含了資料庫物件列表,儘管未在文件中記載,你仍可通過查詢它來獲取你想要的.注 請不要有意或無意地修改任何access系統表,否則會出現不可意料的情況.使用下列 sql 語句來獲取你想要的 查詢 select msysobjects.name from m...