Results 1 to 4 of 4

Thread: Field Description!!

  1. #1

    Thread Starter
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961

    Field Description!!

    I used the following code using DAO to populate arrays with table's field name and field description.

    VB Code:
    1. Dim rsReport as DAO.RecorrSet
    2. rsReport = dbDatabase.OpenRecordset("Table1")
    3. For Idx As Short = 1 To rsReport.Fields.Count - 1
    4.     FieldNames(Idx) = rsReport.Fields(Idx).Name
    5.     Descriptions(Idx) = rsReport.Fields(Idx).Properties("Description").Value
    6. Next

    How to achieve the same result using ADO.Net?

    Please guide

    Regards
    Microsoft Techie

  2. #2
    Addicted Member Hole-In-One's Avatar
    Join Date
    Mar 2003
    Location
    Minnesota
    Posts
    195
    Check out the DataAdapter and the Dataset.

  3. #3

    Thread Starter
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961
    thats so kind of u

    i need an example
    Microsoft Techie

  4. #4
    Addicted Member Hole-In-One's Avatar
    Join Date
    Mar 2003
    Location
    Minnesota
    Posts
    195
    Code:
     ' create a connection string 
            Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Northwind.mdb"
            Dim myConnection As OleDb.OleDbConnection = New OleDb.OleDbConnection
            myConnection.ConnectionString = connString
            ' create a data adapter 
            Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter("Select * from Employees", myConnection)
            ' create a new dataset 
            Dim ds As DataSet = New DataSet
            ' fill dataset 
            Try
                da.Fill(ds, "Employees")
    
            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try
    
    
            For Idx As Integer = 1 To ds.Tables(0).Columns.Count - 1
                MsgBox(ds.Tables(0).Columns(Idx).ColumnName.ToString)
                'FieldNames(Idx) = rsReport.Fields(Idx).Name
                'Descriptions(Idx) = rsReport.Fields(Idx).Properties("Description").Value
            Next
    That'll get you started

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