CSharp Discovering Schema Information – ADO.Net Database

<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Data.Oledb" %><html>
  <head>
    <title> Discovering Schema Information</title>
  </head>
  <body>
    <h3>Discovering Schema Information</h3>
    <asp:DataGrid id="dgSchema" runat="server" />
  </body>
</html><script language="VB" runat="server">
Sub Page_Load(Source As Object, E As EventArgs)
  Dim strConnection As String = "provider=Microsoft.Jet.OLEDB.4.0;" & _
                        "data source="+MapPath("EmployeeDatabase.mdb")+";"
  Dim objConnection As New OleDbConnection(strConnection)  Dim dsSchema As DataSet = New DataSet()
  Dim dtSchema As DataTable  objConnection.Open()
  dtSchema = objConnection.GetOleDbSchemaTable( _
                        OleDbSchemaGuid.Columns, Nothing)  dsSchema.Tables.Add(dtSchema)
  dgSchema.DataSource = dsSchema
  dgSchema.DataBind()
  objConnection.Close()
End Sub
</script>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.