Link to home
Start Free TrialLog in
Avatar of tesla764
tesla764

asked on

VB.net combo box

Here is a code segment that runs successfully
In the part that is enclosed with ************************
I have a check box
When that box is checked we want to display a combo box that retrieves data from fccp.Resller.CompanyName
Could you help with the code to accomplish this?
Thanks in advance

Imports System.Data.SqlClient

Public Class CWActivityReport
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub ButtonRunReport_Click(sender As Object, e As EventArgs) Handles ButtonRunReport.Click
        GetAddedClients()
        GetDeletedClients()
        UpdatePanelReport.Update()

    End Sub

    Private Sub GetAddedClients()
        Dim FCCP_SQL As SqlConnection = Nothing

        Dim FCCP_DATAADAPTOR As SqlDataAdapter = Nothing
        Dim dt As DataTable = Nothing

        Try
            FCCP_SQL = New SqlConnection
            FCCP_SQL.ConnectionString = ConfigurationManager.ConnectionStrings("FCCP_SQL").ConnectionString
            FCCP_DATAADAPTOR = New SqlDataAdapter
            dt = New DataTable
            'FCCP_DATAADAPTOR.SelectCommand = New SqlCommand("SELECT fccp_Reseller.CompanyName AS PartnerCompanyName, fccp_ResellerClients.CreatedDateTime, fccp_ResellerClients.CompanyName AS ClientCompanyName, fccp_ResellerClients.ClientCode AS CompanyCode FROM fccp_ResellerClients INNER JOIN fccp_Reseller ON fccp_ResellerClients.ResellerID = fccp_Reseller.ID WHERE (fccp_ResellerClients.Deleted = 0) AND (fccp_ResellerClients.CreatedDateTime Between @StartDate AND @EndDate) AND NOT fccp_Reseller.ResellerCode='f44' ORDER BY PartnerCompanyName, fccp_ResellerClients.CreatedDateTime ASC", FCCP_SQL)
            FCCP_DATAADAPTOR.SelectCommand = New SqlCommand("SELECT fccp_Reseller.CompanyName AS PartnerCompanyName, fccp_ResellerClients.CreatedDateTime, fccp_ResellerClients.CompanyName AS ClientCompanyName, fccp_ResellerClients.ClientCode AS CompanyCode FROM fccp_ResellerClients INNER JOIN fccp_Reseller ON fccp_ResellerClients.ResellerID = fccp_Reseller.ID WHERE (fccp_ResellerClients.CreatedDateTime Between @StartDate AND @EndDate) AND NOT fccp_Reseller.ResellerCode='f44' ORDER BY PartnerCompanyName, fccp_ResellerClients.CreatedDateTime ASC", FCCP_SQL)
            FCCP_DATAADAPTOR.SelectCommand.Parameters.AddWithValue("@StartDate", TextBoxStartDate.Text + " " + "0:00:00 AM")
            FCCP_DATAADAPTOR.SelectCommand.Parameters.AddWithValue("@EndDate", TextBoxEndDate.Text + " " + "11:59:59 PM")

            dt.Clear()
            FCCP_SQL.Open()
            FCCP_DATAADAPTOR.Fill(dt)

            RepeaterCreatedClients.DataSource = dt
            RepeaterCreatedClients.DataBind()

        Catch ex As Exception
            Debug.WriteLine(ex.Message)
        Finally
            If Not FCCP_SQL Is Nothing Then FCCP_SQL.Dispose()
            If Not FCCP_DATAADAPTOR Is Nothing Then FCCP_DATAADAPTOR.Dispose()
            If Not dt Is Nothing Then dt.Dispose()
        End Try
    End Sub

    Private Sub GetDeletedClients()
        Dim FCCP_SQL As SqlConnection = Nothing

        Dim FCCP_DATAADAPTOR As SqlDataAdapter = Nothing
        Dim dt As DataTable = Nothing

        Try
            FCCP_SQL = New SqlConnection
            FCCP_SQL.ConnectionString = ConfigurationManager.ConnectionStrings("FCCP_SQL").ConnectionString
            FCCP_DATAADAPTOR = New SqlDataAdapter
            dt = New DataTable
            FCCP_DATAADAPTOR.SelectCommand = New SqlCommand("SELECT fccp_Reseller.CompanyName AS PartnerCompanyName, fccp_ResellerClients.DeletedDateTime, fccp_ResellerClients.CompanyName AS ClientCompanyName, fccp_ResellerClients.ClientCode AS CompanyCode FROM fccp_ResellerClients INNER JOIN fccp_Reseller ON fccp_ResellerClients.ResellerID = fccp_Reseller.ID WHERE (fccp_ResellerClients.DeletedDateTime Between @StartDate AND @EndDate) AND NOT fccp_Reseller.ResellerCode='f44' ORDER BY PartnerCompanyName, fccp_ResellerClients.CreatedDateTime ASC", FCCP_SQL)
            'FCCP_DATAADAPTOR.SelectCommand = New SqlCommand("SELECT fccp_Reseller.CompanyName AS PartnerCompanyName, fccp_ResellerClients.DeletedDateTime, fccp_ResellerClients.CompanyName AS ClientCompanyName, fccp_ResellerClients.ClientCode AS CompanyCode FROM fccp_ResellerClients INNER JOIN fccp_Reseller ON fccp_ResellerClients.ResellerID = fccp_Reseller.ID WHERE (fccp_ResellerClients.Deleted = 1) AND (fccp_ResellerClients.DeletedDateTime Between @StartDate AND @EndDate) AND NOT fccp_Reseller.ResellerCode='f44' ORDER BY PartnerCompanyName, fccp_ResellerClients.CreatedDateTime ASC", FCCP_SQL)
            FCCP_DATAADAPTOR.SelectCommand.Parameters.AddWithValue("@StartDate", TextBoxStartDate.Text + " " + "0:00:00 AM")
            FCCP_DATAADAPTOR.SelectCommand.Parameters.AddWithValue("@EndDate", TextBoxEndDate.Text + " " + "11:59:59 PM")

            dt.Clear()
            FCCP_SQL.Open()
            FCCP_DATAADAPTOR.Fill(dt)

            RepeaterDeletedClients.DataSource = dt
            RepeaterDeletedClients.DataBind()

        Catch ex As Exception
            Debug.WriteLine(ex.Message)
        Finally
            If Not FCCP_SQL Is Nothing Then FCCP_SQL.Dispose()
            If Not FCCP_DATAADAPTOR Is Nothing Then FCCP_DATAADAPTOR.Dispose()
            If Not dt Is Nothing Then dt.Dispose()
        End Try
    End Sub

    Protected Sub SIP_CheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles SIP_CheckBox.CheckedChanged
        Dim FCCP_SQL As SqlConnection = Nothing

        Dim FCCP_DATAADAPTOR As SqlDataAdapter = Nothing
        Dim dt As DataTable = Nothing
***************************************************************
        If SIP_CheckBox.Checked Then
            MsgBox("SIP check box was selected")

        End If
    End Sub
***************************************************************

End Class

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of dustock
dustock
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial