Imports System.Data
Imports System.Data.SqlClient

Public Class List
    Inherits System.Web.UI.Page

#Region " Web Form µðÀÚÀÌ³Ê¿¡¼­ »ý¼ºÇÑ ÄÚµå "

    'ÀÌ È£ÃâÀº Web Form µðÀÚÀÌ³Ê¿¡ ÇÊ¿äÇÕ´Ï´Ù.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid

    'Âü°í: ´ÙÀ½ÀÇ ÀÚ¸® Ç¥½ÃÀÚ ¼±¾ðÀº Web Form µðÀÚÀÌ³ÊÀÇ ÇÊ¼ö ¼±¾ðÀÔ´Ï´Ù.
    '»èÁ¦ÇÏ°Å³ª ¿Å±âÁö ¸¶½Ê½Ã¿À.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: ÀÌ ¸Þ¼­µå È£ÃâÀº Web Form µðÀÚÀÌ³Ê¿¡ ÇÊ¿äÇÕ´Ï´Ù.
        'ÄÚµå ÆíÁý±â¸¦ »ç¿ëÇÏ¿© ¼öÁ¤ÇÏÁö ¸¶½Ê½Ã¿À.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not IsPostBack Then
            Listing()
        End If
    End Sub

    Private Sub Listing()
        Dim objCon As SqlConnection
        Dim objCmd As SqlCommand

        objCon = New SqlConnection("server=localhost;user id=dotnetnote;password=dotnetnote;database=dotnetnote")
        objCon.Open()

        objCmd = New SqlCommand("Select Num, Title, Name, PostDate, ReadCount From DotnetNoteBasicVB" & _
                        " Order By Num Desc", objCon)

        DataGrid1.DataSource = objCmd.ExecuteReader()
        DataGrid1.DataBind()

        objCon.Close()
    End Sub

End Class