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,
.NET ProgrammingVisual Basic.NETMicrosoft SQL Server 2008

Avatar of undefined
Last Comment
CloudApps

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
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
or
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
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.
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