CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2001
    Posts
    71

    Post How to find Column Description

    Hi Guys,

    I have a small problem.I m creating a database in SQL Server.Now because of our naming convention standards me coulnn names are not descriptive in nature.For e.g. 'First Name' will be TSUY65FN.

    Now Since it is not possible to remember these name we also store Description of these fields while creating the tables.

    Now comes the real problem.I want to access these descriptions through vb.I am using ADO2.5.

    Can you help Me?

  2. #2
    Join Date
    Mar 2001
    Location
    County Durham, England
    Posts
    238
    You should be able to modify the below to suit your needs ;

    Code:
    Function GetFieldDescription (ByVal MyTableName As String,       ByVal MyFieldName As String)
             Dim DB As Database
             Dim TD As TableDef
             Dim FLD As Field
    
             Set DB = DBEngine.Workspaces(0).Databases(0)
    
             On Error GoTo Err_GetFieldDescription
    
             Set TD = DB.TableDefs(MyTableName)
             Set FLD = TD.Fields(MyFieldName)
    
             GetFieldDescription = FLD.Properties("Description")
    
          Bye_GetFieldDescription:
             Exit Function
    
          Err_GetFieldDescription:
             Beep: MsgBox Error$, 48
             GetFieldDescription = Null
             Resume Bye_GetFieldDescription
    
    End Function

  3. #3
    Join Date
    Apr 2000
    Location
    Southampton, UK
    Posts
    329
    vivek_29, as I understand it (I will attempt to find some reference material to back this up soon the "Description" field in the OLEDB provider is marked as optional and to date the SQL server providers do not actually populate this field though it exists.
    TimCottee
    I know a little about a lot of things and a lot about very little.

    Brainbench MVP For Visual Basic
    http://www.brainbench.com

    MCP, MCSD, MCDBA, CPIM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured