ASP.Net/ADO.net Database/OleDbSchema

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

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>


<A href="http://www.nfex.ru/Code/ASPDownload/EmployeeDatabase.zip">EmployeeDatabase.zip( 10 k)</a>