|
-
Jan 11th, 2007, 05:28 AM
#1
Thread Starter
Addicted Member
[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:
Public Class searchSyllabus
Inherits System.Web.UI.Page
Dim a As New BusinessLayer1.Service1
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim name As String = Request.QueryString("Module")
Dim ds As DataSet
ds = a.getModuleAll
Label10.Text = Convert.ToString(ds.Tables("ModuleName"))
Label8.Text = Convert.ToString(ds.Tables("ModuleName"))
Label9.Text = Convert.ToString(ds.Tables("ModuleCode"))
Label7.Text = Convert.ToString(ds.Tables("Aim"))
Label15.Text = Convert.ToString(ds.Tables("Objectve"))
Label13.Text = Convert.ToString(ds.Tables("PreRequest"))
Label14.Text = Convert.ToString(ds.Tables("ModuleType"))
Label16.Text = Convert.ToString(ds.Tables("Hour"))
Label9.Text = Convert.ToString(ds.Tables("ModeOfTeachingT"))
Label21.Text = Convert.ToString(ds.Tables("ModeOfTeachingP"))
Label22.Text = Convert.ToString(ds.Tables("ModeOfTeachingL"))
Label26.Text = Convert.ToString(ds.Tables("ModeOfAssE"))
Label27.Text = Convert.ToString(ds.Tables("ModeOfAssP"))
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Response.Redirect("staff.aspx")
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim ds As DataSet
ds = a.getModuleML
Dim id As String
id = Convert.ToString(ds.Tables("ML"))
If id = id Then
Response.Redirect("UpdateSyllabus.aspx")
ElseIf id & id Then
End If
End Sub
My business layer as follows:
VB Code:
<WebMethod()> _
Public Function populateStaffData() As DataSet
Dim dataLayer As New CAPS_DATA.Service1
Dim ds As New DataSet
'getDataSet
ds = dataLayer.getDataSet("SELECT * FROM staff")
Return ds
End Function
<WebMethod()> _
Public Function populateNotAssignedData() As DataSet
Dim data As New CAPS_DATA.Service1
Dim ds As New DataSet
'getDataSet
ds = data.getDataSet("SELECT [Module Code],[Module Name] FROM assignmodules WHERE status = 'not assigned' ")
Return ds
End Function
<WebMethod()> _
Public Function populateAssignedData() As DataSet
Dim data As New CAPS_DATA.Service1
Dim ds As New DataSet
'getDataSet
ds = data.getDataSet("SELECT [Module Code],[Module Name] FROM assignmodules WHERE status = 'assigned' ")
Return ds
End Function
<WebMethod()> _
Public Function getModule() As DataSet
Dim data As New CAPS_datalayer.Service1
Dim ds As New DataSet
'getDataSet
ds = data.getDataSet("SELECT [Module Code] FROM Module ")
Return ds
End Function
<WebMethod()> _
Public Function getModuleAll() As DataSet
Dim data As New CAPS_datalayer.Service1
Dim ds As New DataSet
'getDataSet
ds = data.getDataSet("SELECT * FROM Module when ModuleCode = code ")
Return ds
End Function
Public Function getModuleML() As DataSet
Dim data As New CAPS_datalayer.Service1
Dim ds As New DataSet
'getDataSet
ds = data.getDataSet("SELECT ML FROM Module WHERE ModuleCode = 1123")
Return ds
End Function
Public Function updatemodule() As DataSet
Dim data As New CAPS_datalayer.Service1
Dim ds As New DataSet
'getDataSet
ds = data.getDataSet("Update * when ModuleCode =code")
Return ds
End Function
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. 
-
Jan 11th, 2007, 10:40 AM
#2
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?
-
Jan 11th, 2007, 11:30 AM
#3
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?
-
Jan 11th, 2007, 07:10 PM
#4
Thread Starter
Addicted Member
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. 
-
Jan 15th, 2007, 06:58 AM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|