Link to home
Start Free TrialLog in
Avatar of CloudApps
CloudApps

asked on

Run a Insert...Select statement from a Web page.

I have a web page that launches a Crystal Report. The report prints mailing labels for expiration notices that are being sent out.

I need to append records to an event history table in the database for the expiration notices.

Here is the Visual Basic code for the button that launches the labels:
--------------------------------------------------------------------------------------------------------------------------------
   Protected Sub Button_Preview_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button_Preview.Click

        If (Session("report") Is Nothing) Then

            Dim rd As New ReportDocument
            rd.Load(Server.MapPath("ExpirationNoticesMailingLabels.rpt"))
            Dim boConnectionInfo As CrystalDecisions.Shared.IConnectionInfo

            For Each boConnectionInfo In rd.DataSourceConnections
                boConnectionInfo.SetLogon("UserName", "Password")
            Next

            Session.Add("report", rd)
            CrystalReportViewer1.ReportSource = Session("Report")
            rd.SetParameterValue("Months To Expiration", Me.MonthsToExpiration.SelectedValue)

        End If

    End Sub
------------------------------------------------------------------------------------------------------------------------------

Please point me in the right direction for executing my Insert...Select statement.

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland 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
Avatar of CloudApps
CloudApps

ASKER

CodeCruiser,

I was refering to an INSERT INTO with a SELECT statement instead of a VALUE statement.

After some additional research, I have created a Stored Procedure to be executed.

Thanks for the help.