web 2.0

VB.NET & DataSet()

VB.NET & DataSet() Represents an in-memory cache of data. The DataSet object is central to supporting disconnected, distributed data scenarios with ADO.NET. The DataSet is a memory-resident representation of data that provides a consistent relational programming model regardless of the data source.

ShotDev Focus:
- VB.NET & DataSet()

Example

DataSet.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 objCmd As New System.Data.OleDb.OleDbCommand
Dim dtAdapter As New System.Data.OleDb.OleDbDataAdapter

Dim ds As New DataSet
Dim strConnString,strSQL As String

strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("database/mydatabase.mdb")&";Jet OLEDB:Database Password=;"
strSQL = "SELECT * FROM customer"

objConn.ConnectionString = strConnString
With objCmd
.Connection = objConn
.CommandText = strSQL
.CommandType = CommandType.Text
End With
dtAdapter.SelectCommand = objCmd

dtAdapter.Fill(ds)

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.