Discovering Schema Information : OleDbSchema « ADO.net Database « ASP.Net






Discovering Schema Information

<%@ 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>
           
       








EmployeeDatabase.zip( 10 k)

Related examples in the same category