Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_mobile thread: Displaying Mobile Dataset


Message #1 by "F-J Mattmann" <f-j.mattmann@e...> on Thu, 30 May 2002 15:31:56
Hi
I am trying to bind some SQL Data from the Dataset, I did this and it 
works in conventional ASPX.NET but I do not know how to do it  in 
Mobile.NET, it works nearly, only that nothingg appears as result I only 
get 

"System.Data.DataRowView "
as result.

Here is the code:

<%@ 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.SqlClient" %>
<script language="VB" runat="server">

''''''''''''''''' Open the database and fill the dataset ''''''''''

  Sub vald_datum2(Sender As Object, E As EventArgs) 


	Dim Kalle as string
	Kalle = " 23:59:00"
	Dim datumet as Date
	Dim datumet2 as string
	datumet = (Calendar1.SelectedDate.ToShortDateString)
	datumet2= ((datumet)+(Kalle))


        Dim DS As DataSet
	Dim DS_A As DataSet

	Dim MyConnection As SqlConnection
	MyConnection = New SqlConnection
("server=SORBA;database=extrraDB;UID=hemligt")
         
	  
	  Dim MyCommand As SqlDataAdapter
	  Dim MyCommand1 As SqlDataAdapter
	  Dim MyCommand2 As SqlDataAdapter
          Dim MyCommand3 As SqlDataAdapter
	  Dim MyCommand4 As SqlDataAdapter	
	  Dim MyCommand5 As SqlDataAdapter
          Dim MyCommand6 As SqlDataAdapter
	  Dim MyCommand7 As SqlDataAdapter
	  Dim MyCommand8 As SqlDataAdapter

	  
 	  	MyCommand = New SqlDataAdapter("select count(*) from 
tblLog where Datum > " & "'" & datumet & "' AND Datum < " & "'" & datumet2 
& "'", MyConnection)
		
		MyCommand1 = New SqlDataAdapter("select  count(*) from 
tblLog where Datum > " & "'" & datumet & "' AND Datum < " & "'" & datumet2 
& "' AND Forv = '011J0000K019'", MyConnection)
		MyCommand2 = New SqlDataAdapter("select count(*) from 
tblLog where Datum > " & "'" & datumet & "' AND Datum < " & "'" & datumet2 
& "' AND Forv = '011J0000K02Y'", MyConnection)
		MyCommand3 = New SqlDataAdapter("select count(*) from 
tblLog where Datum > " & "'" & datumet & "' AND Datum < " & "'" & datumet2 
& "' AND Forv = '011J0000K00O'", MyConnection)
		MyCommand4 = New SqlDataAdapter("select count(*) from 
tblLog where Datum > " & "'" & datumet & "' AND Datum < " & "'" & datumet2 
& "' AND Forv = '011J0000L06K'", MyConnection)
		MyCommand5 = New SqlDataAdapter("select count(*) from 
tblLog where Datum > " & "'" & datumet & "' AND Datum < " & "'" & datumet2 
& "' AND Forv = '011J0000L07Q'", MyConnection)
		MyCommand6 = New SqlDataAdapter("select count(*) from 
tblLog where Datum > " & "'" & datumet & "' AND Datum < " & "'" & datumet2 
& "' AND Forv = '011J0000L066'", MyConnection)
		MyCommand7 = New SqlDataAdapter("select count(*) from 
tblLog where Datum > " & "'" & datumet & "' AND Datum < " & "'" & datumet2 
& "' AND Forv = '011J0000K020'", MyConnection)
		MyCommand8 = New SqlDataAdapter("select count(*) from 
tblLog where Datum > " & "'" & datumet & "' AND Datum < " & "'" & datumet2 
& "' AND Forv = '011J0000L02F'", MyConnection)
				

        DS = new DataSet()
	
	
        MyCommand.Fill(ds, "tblLog")
	MyCommand1.Fill(ds, "tblLog")
	MyCommand2.Fill(ds, "tblLog")
	MyCommand3.Fill(ds, "tblLog")
	MyCommand4.Fill(ds, "tblLog")
	MyCommand5.Fill(ds, "tblLog")
	MyCommand6.Fill(ds, "tblLog")
	MyCommand7.Fill(ds, "tblLog")
	MyCommand8.Fill(ds, "tblLog")

        Mydatalist.DataSource=ds.Tables("tblLog").DefaultView

      
        MyDataList.DataBind()

  End Sub

</script>

<mobile:Form id="Form1" runat=server>

  <mobile:Label runat=server StyleReference="Title">Pick upp a 
date:</mobile:Label>
  <mobile:Calendar id="Calendar1" OnSelectionChanged="vald_datum2" 
runat=server/>

<mobile:List id="MyDataList" runat="server">
   <ItemTemplate>
        <%# DataBinder.Eval(Container.Datavaluefield, "column1")%> &nbsp;
  </ItemTemplate>

</mobile:List>

</mobile:Form>

============================================================0

'''''''''''''' Thatīs here in the row:
<%# DataBinder.Eval(Container.Datavaluefield, "column1")%> &nbsp;

that the problem seems to be I do not know what to write there? 
Container.datafield or something else???????


  Return to Index