dotMobimobiThinkingmobiForgemobiReadyDeviceAtlasgoMobi

Posted by LuizItatiba 3 years 45 weeks ago

pic
 LuizItatiba
mobiForge Newbie
Posts: 2
Joined: 3 years ago
[offline]

Hello Staff of the Mobile Asp.Net good day, I am a newcomer in ASP.NET Mobile and saw an article on net siarad access data with the object ObjectList occurred the following error code below

Well the error that happened was that this line of code
down

ObjectList1.DataSource = DSPageData.Tables
("Emps").DefaultView; // Error 'System.Data.DataSet.Tables' is
a 'property', but is used as' method '

Here the complete code of the code-behind in Asp.Net Mobile CSharp

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Mobile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.MobileControls;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
 
public partial class _Default : System.Web.UI.MobileControls.MobilePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
	        OleDbConnection DBConn; 
	        OleDbDataAdapter DBCommand; 
	        DataSet DSPageData = 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; // Error 'System.Data.DataSet.Tables' is 
a 'property', but is used as' method '
	        ObjectList1.DataBind(); 
 
    }
}

Here the Source.aspx the same code that is in Web.MobileForms

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    <mobile:Form id="Form1" runat="server">
        <mobile:ObjectList ID="ObjectList1" Runat="server" CommandStyle-StyleReference="subcommand"
            LabelStyle-StyleReference="title">
        </mobile:ObjectList>
 
    </mobile:Form>
</body>
</html>

If someone can help me now thank you

Translated from Portuguese / Brazil into English by Google