I need help urgently for 3-tier coding in retrieving data from database and display it in label. It would be a great help if anyone solve it for me. thanks
I got the code for data access layer but im not sure if it's right:
Public Function getFeedbackQ(ByVal Question1 As String, ByVal Question2 As String, ByVal Question3 As String) As System.Data.DataSet
Dim connectionString As String = My.Settings.dbConnection
Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)
Dim queryString As String = "Select Question1, Question2, Question3, SchoolName from FeedbackForms "
Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
Dim dataAdapter As SqlDataAdapter = New System.Data.SqlClient.SqlDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet, "AllQuestions")
Return dataSet
End Function
& this is the code in business layer:
Public Function getFeedbackQ(ByVal Question1 As String, ByVal Question2 As String, ByVal Question3 As String, ByVal SchoolName As String) As System.Data.DataSet
Dim ds As Data.DataSet = UserDA.getFeedbackQ(Question1, Question2, Question3, SchoolName)
Return ds
End Function
& in the presentation layer (page load):
Dim UserController As New BusinessLogic.UserBLL
Dim ds As System.Data.DataSet = UserController.getFeedbackQ(label1.Text, label2.Text, label3.Text)