W Who Apr 17, 2006 #1 What is the easiest way to get the names of the fields in an Access database table using VB.net 2005 and ADO.net? MBS
What is the easiest way to get the names of the fields in an Access database table using VB.net 2005 and ADO.net? MBS
C Cor Ligthert [MVP] Apr 18, 2006 #2 What is the easiest way to get the names of the fields in an Access database table using VB.net 2005 and ADO.net? Click to expand... What do you mean, a schema or looking at the tables using Visual Studio Net? or this http://msdn2.microsoft.com/en-us/library/kcax58fh(VS.80).aspx Please be a little bit more clear in your messages. However I assume you are asking for the last, I hope this helps, Cor
What is the easiest way to get the names of the fields in an Access database table using VB.net 2005 and ADO.net? Click to expand... What do you mean, a schema or looking at the tables using Visual Studio Net? or this http://msdn2.microsoft.com/en-us/library/kcax58fh(VS.80).aspx Please be a little bit more clear in your messages. However I assume you are asking for the last, I hope this helps, Cor
P Paul Clement Apr 18, 2006 #3 ¤ What is the easiest way to get the names of the fields in an Access database ¤ table using VB.net 2005 and ADO.net? ¤ Below is an example of what Cor was referring to: Dim DatabaseConnection As New System.Data.OleDb.OleDbConnection Dim SchemaTable As DataTable DatabaseConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Test Files\db1 XP.mdb" DatabaseConnection.Open() SchemaTable = DatabaseConnection.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Columns, _ New Object() {Nothing, Nothing, "Table1"}) Dim RowCount As Int32 For RowCount = 0 To SchemaTable.Rows.Count - 1 Console.WriteLine(SchemaTable.Rows(RowCount)!COLUMN_NAME.ToString) Next RowCount 'Shows what column schema info is available DataGrid1.DataSource = SchemaTable DatabaseConnection.Close() Paul ~~~~ Microsoft MVP (Visual Basic)
¤ What is the easiest way to get the names of the fields in an Access database ¤ table using VB.net 2005 and ADO.net? ¤ Below is an example of what Cor was referring to: Dim DatabaseConnection As New System.Data.OleDb.OleDbConnection Dim SchemaTable As DataTable DatabaseConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Test Files\db1 XP.mdb" DatabaseConnection.Open() SchemaTable = DatabaseConnection.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Columns, _ New Object() {Nothing, Nothing, "Table1"}) Dim RowCount As Int32 For RowCount = 0 To SchemaTable.Rows.Count - 1 Console.WriteLine(SchemaTable.Rows(RowCount)!COLUMN_NAME.ToString) Next RowCount 'Shows what column schema info is available DataGrid1.DataSource = SchemaTable DatabaseConnection.Close() Paul ~~~~ Microsoft MVP (Visual Basic)