VB.NET & DataAdapter() The DataAdapter represents a set of data commands and a connection to a database that are used to fill the DataSet and update the database. This class cannot be inherited
ShotDev Focus:
- VB.NET & DataAdapter()
Example
DataAdapter.aspx
- <%@ Import Namespace="System.Data"%>
- <%@ Import Namespace="System.Data.OleDb"%>
- <%@ Page Language="VB" %>
- <script runat="server">
- Dim objConn As New System.Data.OleDb.OleDbConnection
- Dim dtAdapter As System.Data.OleDb.OleDbDataAdapter
- Dim dt As New DataTable
- Dim strConnString As String
- strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("database/mydatabase.mdb")&";Jet OLEDB:Database Password=;"
- objConn = New System.Data.OleDb.OleDbConnection(strConnString)
- objConn.Open()
- Dim strSQL As String
- strSQL = "SELECT * FROM customer"
- dtAdapter = New System.Data.OleDb.OleDbDataAdapter(strSQL, objConn)
- dtAdapter.Fill(dt)
- dtAdapter = Nothing
- objConn.Close()
- objConn = Nothing
- </script>