Bind asp:DataGrid to access database (VB.net) : DataGrid « ADO.net Database « ASP.Net

ASP.Net
1. ADO.net Database
2. Asp Control
3. Collections
4. Components
5. Data Binding
6. Development
7. HTML Control
8. Mobile Control
9. Page
10. Request
11. Response
12. Server
13. Session Cookie
14. User Control and Master Page
15. Validation by Control
16. Validation by Function
17. XML
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
ASP.Net » ADO.net Database » DataGrid 
Bind asp:DataGrid to access database (VB.net)

<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.Oledb" %>

<script language="vb" runat="server">
  Sub Page_Load()
    Dim strConnection as String = "Provider=Microsoft.Jet.OLEDB.4.0;"
      strConnection += "Data Source=yourDatabase.mdb"
      data_src.text = strConnection
    Dim strSQL as string = "SELECT * FROM products;"
    Dim objDataSet as new DataSet()

    Dim objConnection as new OledbConnection(strConnection)
    Dim objAdapter as new OledbDataAdapter(strSQL, objConnection)

    objAdapter.Fill(objDataSet, "products")

    Dim objDataView as New DataView(objDataSet.Tables("products"))

    dgNameList.DataSource=objDataView
    dgNameList.DataBind()
  end Sub
</script>
<html>
  <body>
  <h4>Reading data from the connection
  <asp:label id="data_src" runat="server"/> to the DataGrid control.</h4>
  <asp:datagrid id="dgNameList" runat="server" /><br />
  </body>
</html>

           
       
Related examples in the same category
1. Pagable datagrid (VB.net)
2. Bind data through SqlConnection to asp:DataGrid (VB.net)
3. Bind to two different asp:datagrid (VB.net)
4. asp:datagrid: sort expression (VB.net)
5. Sort asp:datagrid (VB.net)
6. Bind Data to asp DataGrid in C#
7. Set asp:datagrid title bar (C#)
ww__w.__j___a___va___2___s___._c___o_m | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.