能不能得到SQLSERVER的字段描述值

heiheidan 2004-11-01 08:35:01
各位大侠,能不能得到SQLSERVER的字段描述值?有的话请给出简单的代码。谢谢
...全文
104 点赞 收藏 4
写回复
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
laoQ 2004-11-04
学习中……
帮UP
回复
DongCd 2004-11-03
SELECT a.name AS 表名, b.name AS 字段, c.name AS 字段类型
FROM sysobjects a INNER JOIN
syscolumns b ON a.id = b.id INNER JOIN
systypes c ON b.xtype = c.xtype
WHERE (a.name = 't_mobile')
把t_mobile替换成你想看的表名即可
回复
啊呀 2004-11-01
我也很想知道
回复
daisy8675 2004-11-01
Option Explicit

Dim db As Database

'以下 Function 需要二个参数,sTable 是 Table 名称,sField 是字段名称
Function Getdescription(sTable As String, sField As String) As String
Dim Sna As Recordset
Dim i As Integer
Dim existDescr As Boolean

Set Sna = db.OpenRecordset(sTable, dbOpenTable)
existDescr = False
For i = 0 To Sna(sField).Properties.Count - 1
If Sna(sField).Properties(i).Name = "Description" Then
existDescr = True: Exit For
End If
Next

If existDescr Then
Getdescription = Sna(sField).Properties("Description")
Else
Getdescription = ""
End If
End Function

Private Sub Command1_Click()
Dim x As String
MsgBox Getdescription("AABLE_L", "AABLE_LNO")
End Sub

Private Sub Form_Load()
Set db = opendatabase("c:\hris\ability.mdb") '数据库
End Sub


这是抓ACCESS的办法。
回复
发动态
发帖子

1180

社区成员

VB 数据库(包含打印,安装,报表)
申请成为版主
社区公告
暂无公告