Imports System.Data
Imports System
Imports System.Data.SqlClient
Imports System.Data.Common
Imports Microsoft.Practices.EnterpriseLibrary.Data

Partial Class Default2
    Inherits System.Web.UI.Page
    Private _cmd As DbCommand
    Private _db As Database

    Private Property DB() As Database
        Get
            Return _db
        End Get
        Set(ByVal value As Database)
            _db = value
        End Set
    End Property
    Private Property CMD() As DbCommand
        Get
            Return _cmd
        End Get
        Set(ByVal value As DbCommand)
            _cmd = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Dim str As String = Request.QueryString("id")
        'Dim i As Integer = CType(str, Integer)
        'Dim myconn As SqlConnection = New SqlConnection()
        'myconn.ConnectionString = "user id=charterdotcomdbo;password=charter!;server=CC2UAT;database=CharterDotCom;Trusted_Connection=false"
        'myconn.Open()
        'Try
        '    Dim cmd As String = "support.GET_COMMENTS"
        '    Dim mycommand As SqlCommand = New SqlCommand(cmd, myconn)
        '    mycommand.CommandType = CommandType.StoredProcedure
        '    Dim myadapt As SqlDataAdapter = New SqlDataAdapter() 
        '    Dim param As SqlParameter = New SqlParameter("@documentid", SqlDbType.BigInt)

        '    param.Value = i

        '    myadapt.SelectCommand = mycommand
        '    myadapt.SelectCommand.Parameters.Add(param)

        '    Dim mydataset As DataSet = New DataSet()
        '    myadapt.Fill(mydataset)

        '    dataGrid1.DataSource = mydataset
        '    dataGrid1.DataBind()
        'Catch ex As Exception
        '    Throw ex
        'Finally

        '    myconn.Close()

        'End Try
        Me.DB = DatabaseFactory.CreateDatabase("Charter.Website.WS.CommerceEngineConnectionString")


        Try
            Dim localID As Integer = Request.QueryString("id")

            Me.CMD = DB.GetStoredProcCommand("SUPPORT.GET_COMMENTS")

            If localID > 0 Then
                DB.AddInParameter(CMD, "@DOCUMENTID", DbType.Int32, localID)
            End If

            Dim retCode As Data.DataSet = DB.ExecuteDataSet(CMD)

            dataGrid1.DataSource = retCode
            dataGrid1.DataBind()


        Catch ex As Exception
            Throw ex
        Finally

        End Try




        'Try
        '    Dim strSQL As String = "support.GET_COMMENTS"

        '    Me.CMD = DB.GetStoredProcCommand(strSQL)

        '    Dim retCode As Data.DataSet = DB.ExecuteDataSet(CMD)

        '    dataGrid1.DataSource = retCode
        '    dataGrid1.DataBind()
        'Catch ex As Exception
        '    Throw ex
        'Finally

        'End Try


    End Sub
End Class
