web 2.0

VB.NET & DataTable()

VB.NET & DataTable() A DataTable, which represents one table of in-memory relational data, can be created and used independently, or can be used by other .NET Framework objects, most commonly as a member of a DataSet.

ShotDev Focus:
- VB.NET & DataTable()

Example

DataTable.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>

.
.
.
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.