|
-
Mar 18th, 2004, 10:09 AM
#1
Thread Starter
Fanatic Member
Field Description!!
I used the following code using DAO to populate arrays with table's field name and field description.
VB Code:
Dim rsReport as DAO.RecorrSet
rsReport = dbDatabase.OpenRecordset("Table1")
For Idx As Short = 1 To rsReport.Fields.Count - 1
FieldNames(Idx) = rsReport.Fields(Idx).Name
Descriptions(Idx) = rsReport.Fields(Idx).Properties("Description").Value
Next
How to achieve the same result using ADO.Net?
Please guide
Regards
-
Mar 18th, 2004, 09:33 PM
#2
Addicted Member
Check out the DataAdapter and the Dataset.
-
Mar 19th, 2004, 04:49 AM
#3
Thread Starter
Fanatic Member
thats so kind of u
i need an example
-
Mar 19th, 2004, 12:22 PM
#4
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|