web 2.0

VB.NET & DataAdapter()

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

  1. <%@ Import Namespace="System.Data"%>  
  2. <%@ Import Namespace="System.Data.OleDb"%>  
  3. <%@ Page Language="VB" %>  
  4. <script runat="server">  
  5.   
  6. Dim objConn As New System.Data.OleDb.OleDbConnection  
  7. Dim dtAdapter As System.Data.OleDb.OleDbDataAdapter  
  8. Dim dt As New DataTable  
  9.   
  10. Dim strConnString As String  
  11. strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("database/mydatabase.mdb")&";Jet OLEDB:Database Password=;"  
  12. objConn = New System.Data.OleDb.OleDbConnection(strConnString)  
  13. objConn.Open()  
  14.   
  15. Dim strSQL As String  
  16. strSQL = "SELECT * FROM customer"  
  17.   
  18. dtAdapter = New System.Data.OleDb.OleDbDataAdapter(strSQL, objConn)  
  19. dtAdapter.Fill(dt)  
  20.   
  21. dtAdapter = Nothing  
  22. objConn.Close()  
  23. objConn = Nothing  
  24.   
  25. </script>  

.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.