thathy
December 17th, 2005, 10:42 AM
hello, im developing a Mobile application using vb.net in asp.net environment.
i would like to know how to use list controls to display data from a database..
below is the codes im trying to use .. it does not seem be working...
pls HELP!!!
Public Class MobileWebForm1
Inherits System.Web.UI.MobileControls.MobilePage
Protected listname As DataList
Private constr As String = "Initial Catalog=mobiledb;Data Source=thathy;Integrated Security=SSPI;;persist security info=False;Trusted_Connection=Yes"
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents List1 As System.Web.UI.MobileControls.List
Protected WithEvents Form1 As System.Web.UI.MobileControls.Form
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Sel As String
Sel = "Select hotel_name,star_rating,hotel_description from hotels "
Dim sqlConnection1 As New SqlConnection(constr)
Dim cmd As New SqlCommand(Sel, sqlConnection1)
Dim sqldataadapter1 As New SqlDataAdapter(cmd)
Dim mobiledb As New DataSet
sqldataadapter1.Fill(mobiledb, "hotels")
sqlConnection1.Close()
List1.DataSource = mobiledb.Tables("hotels")
List1.DataBind()
End Sub
i would like to know how to use list controls to display data from a database..
below is the codes im trying to use .. it does not seem be working...
pls HELP!!!
Public Class MobileWebForm1
Inherits System.Web.UI.MobileControls.MobilePage
Protected listname As DataList
Private constr As String = "Initial Catalog=mobiledb;Data Source=thathy;Integrated Security=SSPI;;persist security info=False;Trusted_Connection=Yes"
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents List1 As System.Web.UI.MobileControls.List
Protected WithEvents Form1 As System.Web.UI.MobileControls.Form
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Sel As String
Sel = "Select hotel_name,star_rating,hotel_description from hotels "
Dim sqlConnection1 As New SqlConnection(constr)
Dim cmd As New SqlCommand(Sel, sqlConnection1)
Dim sqldataadapter1 As New SqlDataAdapter(cmd)
Dim mobiledb As New DataSet
sqldataadapter1.Fill(mobiledb, "hotels")
sqlConnection1.Close()
List1.DataSource = mobiledb.Tables("hotels")
List1.DataBind()
End Sub