Results 1 to 5 of 5

Thread: [02/03] Error with label retrieve from database

  1. #1

    Thread Starter
    Addicted Member JuzMe's Avatar
    Join Date
    Jul 2006
    Posts
    209

    [02/03] Error with label retrieve from database

    I have these codes and I could not get the values of my database to the label

    My presentation layer:

    VB Code:
    1. Public Class searchSyllabus
    2.     Inherits System.Web.UI.Page
    3.     Dim a As New BusinessLayer1.Service1
    4.     Private designerPlaceholderDeclaration As System.Object
    5.  
    6.     Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    7.        
    8.  
    9.     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    10.         Dim name As String = Request.QueryString("Module")
    11.         Dim ds As DataSet
    12.         ds = a.getModuleAll
    13.         Label10.Text = Convert.ToString(ds.Tables("ModuleName"))
    14.         Label8.Text = Convert.ToString(ds.Tables("ModuleName"))
    15.         Label9.Text = Convert.ToString(ds.Tables("ModuleCode"))
    16.         Label7.Text = Convert.ToString(ds.Tables("Aim"))
    17.         Label15.Text = Convert.ToString(ds.Tables("Objectve"))
    18.         Label13.Text = Convert.ToString(ds.Tables("PreRequest"))
    19.         Label14.Text = Convert.ToString(ds.Tables("ModuleType"))
    20.         Label16.Text = Convert.ToString(ds.Tables("Hour"))
    21.         Label9.Text = Convert.ToString(ds.Tables("ModeOfTeachingT"))
    22.         Label21.Text = Convert.ToString(ds.Tables("ModeOfTeachingP"))
    23.         Label22.Text = Convert.ToString(ds.Tables("ModeOfTeachingL"))
    24.         Label26.Text = Convert.ToString(ds.Tables("ModeOfAssE"))
    25.         Label27.Text = Convert.ToString(ds.Tables("ModeOfAssP"))
    26.  
    27.  
    28.  
    29.     End Sub
    30.  
    31.  
    32.     Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    33.         Response.Redirect("staff.aspx")
    34.     End Sub
    35.  
    36.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    37.         Dim ds As DataSet
    38.         ds = a.getModuleML
    39.         Dim id As String
    40.         id = Convert.ToString(ds.Tables("ML"))
    41.         If id = id Then
    42.             Response.Redirect("UpdateSyllabus.aspx")
    43.         ElseIf id & id Then
    44.  
    45.  
    46.  
    47.         End If
    48.  
    49.     End Sub

    My business layer as follows:

    VB Code:
    1. <WebMethod()> _
    2.     Public Function populateStaffData() As DataSet
    3.  
    4.         Dim dataLayer As New CAPS_DATA.Service1
    5.  
    6.  
    7.         Dim ds As New DataSet
    8.         'getDataSet
    9.         ds = dataLayer.getDataSet("SELECT * FROM staff")
    10.  
    11.         Return ds
    12.     End Function
    13.  
    14.     <WebMethod()> _
    15.    Public Function populateNotAssignedData() As DataSet
    16.  
    17.         Dim data As New CAPS_DATA.Service1
    18.  
    19.  
    20.         Dim ds As New DataSet
    21.         'getDataSet
    22.         ds = data.getDataSet("SELECT [Module Code],[Module Name] FROM assignmodules WHERE status = 'not assigned' ")
    23.  
    24.         Return ds
    25.     End Function
    26.     <WebMethod()> _
    27.   Public Function populateAssignedData() As DataSet
    28.  
    29.         Dim data As New CAPS_DATA.Service1
    30.  
    31.  
    32.         Dim ds As New DataSet
    33.         'getDataSet
    34.         ds = data.getDataSet("SELECT [Module Code],[Module Name] FROM assignmodules WHERE status = 'assigned' ")
    35.  
    36.         Return ds
    37.     End Function
    38.  
    39.     <WebMethod()> _
    40.   Public Function getModule() As DataSet
    41.  
    42.         Dim data As New CAPS_datalayer.Service1
    43.  
    44.  
    45.  
    46.         Dim ds As New DataSet
    47.         'getDataSet
    48.         ds = data.getDataSet("SELECT [Module Code] FROM Module ")
    49.  
    50.         Return ds
    51.     End Function
    52.     <WebMethod()> _
    53.   Public Function getModuleAll() As DataSet
    54.  
    55.         Dim data As New CAPS_datalayer.Service1
    56.  
    57.  
    58.  
    59.         Dim ds As New DataSet
    60.         'getDataSet
    61.         ds = data.getDataSet("SELECT * FROM Module when ModuleCode = code ")
    62.  
    63.         Return ds
    64.     End Function
    65.  
    66.     Public Function getModuleML() As DataSet
    67.  
    68.         Dim data As New CAPS_datalayer.Service1
    69.  
    70.  
    71.  
    72.         Dim ds As New DataSet
    73.         'getDataSet
    74.         ds = data.getDataSet("SELECT    ML FROM         Module WHERE     ModuleCode = 1123")
    75.  
    76.         Return ds
    77.     End Function
    78.  
    79.     Public Function updatemodule() As DataSet
    80.  
    81.         Dim data As New CAPS_datalayer.Service1
    82.  
    83.  
    84.  
    85.         Dim ds As New DataSet
    86.         'getDataSet
    87.         ds = data.getDataSet("Update * when ModuleCode =code")
    88.  
    89.         Return ds
    90.     End Function
    91. End Class

    Can anyone tell me wat is wrong?
    I am such a VB.NET 2005 idiot. Sorry If I don't even know basic stuff.

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [02/03] Error with label retrieve from database

    well I will assume its a copy/paste error because this line

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

    has no "End Sub"

    However that would cause the code to not even comple.

    So what line do you actually get the error on?

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [02/03] Error with label retrieve from database

    What is the error? Have you stepped through your code to see if the dataset is being filled?

  4. #4

    Thread Starter
    Addicted Member JuzMe's Avatar
    Join Date
    Jul 2006
    Posts
    209

    Re: [02/03] Error with label retrieve from database

    I just can't retrieve data from my database to my label. That is my error
    I am such a VB.NET 2005 idiot. Sorry If I don't even know basic stuff.

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [02/03] Error with label retrieve from database

    Did you step through the code?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width