Bind data from database to mobile object list (VB.net) : objectlist « Mobile Control « ASP.Net






Bind data from database to mobile object list (VB.net)

<%@ Page 
    Inherits="System.Web.UI.MobileControls.MobilePage" 
    Language="VB" 
%>
<%@ Register 
    TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" 
%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OLEDB" %>
<script runat="server" language="VB">
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
    Dim DBConn as OleDbConnection
    Dim DBCommand As OleDbDataAdapter
    Dim DSPageData as New DataSet
    DBConn = New OleDbConnection( _
        "PROVIDER=Microsoft.Jet.OLEDB.4.0;" _
        & "DATA SOURCE=" _
        & Server.MapPath("EmployeeDatabase.mdb;"))
    DBCommand = New OleDbDataAdapter _
        ("Select * " _
        & "From Employee " _
        & "Order By FirstName", DBConn)
    DBCommand.Fill(DSPageData, _
        "Emps")
    ObjectList1.DataSource = _
        DSPageData.Tables("Emps").DefaultView
    ObjectList1.DataBind()
End Sub</script>
<mobile:form 
    id="StartForm" 
    runat="server">
<mobile:objectlist
    runat="server" 
    id="ObjectList1"
    backcommandtext="Return to List"
/>
</mobile:form>
           
       








EmployeeDatabase.zip( 10 k)

Related examples in the same category