Avatar of 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
            Dim boConnectionInfo As CrystalDecisions.Shared.IConnectionInfo

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

            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.

.NET ProgrammingVisual Basic.NETMicrosoft SQL Server 2008

Avatar of undefined
Last Comment

8/22/2022 - Mon
Nasir Razzaq

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question


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.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy