DARK__FOXX
Member
- Joined
- Sep 2, 2020
- Messages
- 16
- Programming Experience
- Beginner
Hi everyone,
I created this class to read data from db:
and I have added inside Page Load on main page , but doesn't show the table that I have created inside file aspx and I don't want to put this method inside main page.
This is as how to call class inside Page Load()
Thanks for help!!!!
I created this class to read data from db:
VB.NET:
Public Class Class_LECTURE_TABLE_01
Dim connection_DB As New Class_CN_DB_XXXXXX("XXXXXXXXXX")
Dim cn As New SqlConnection(connection_DB.Connessione)
Dim MyParm As SqlParameter
Dim cmd As New SqlCommand
Dim dataAdapter As New SqlDataAdapter(cmd)
Dim dataTbl As New DataTable
Private Repeater1 As Repeater
Public Sub LECTURE_TABLE_01()
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = cn
cmd.CommandText = "LST_LECTURE_TABLE_01"
Try
cn.Open()
dataAdapter.Fill(dataTbl)
Repeater1.DataSource = dataTbl
Repeater1.DataBind()
Catch ex As Exception
MsgBox(ex.Message)
Finally
cn.Close()
End Try
End Sub
and I have added inside Page Load on main page , but doesn't show the table that I have created inside file aspx and I don't want to put this method inside main page.
This is as how to call class inside Page Load()
VB.NET:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Dim lecture_value_TABLE As New Class_LECTURE_TABLE_01()
lecture_value_TABLE.LECTURE_TABLE_01()
End If
End Sub
Thanks for help!!!!