Click here to Skip to main content
15,904,153 members
Home / Discussions / Database
   

Database

 
QuestionUsing .Net and SMO on multiple SQL versions Pin
devenv.exe11-Dec-12 23:45
professionaldevenv.exe11-Dec-12 23:45 
AnswerRe: Using .Net and SMO on multiple SQL versions Pin
Eddy Vluggen12-Dec-12 3:10
professionalEddy Vluggen12-Dec-12 3:10 
QuestionSelecting issue in SQl Server Pin
rakeshs31211-Dec-12 23:06
rakeshs31211-Dec-12 23:06 
AnswerRe: Selecting issue in SQl Server Pin
Eddy Vluggen12-Dec-12 3:07
professionalEddy Vluggen12-Dec-12 3:07 
QuestionGenerating Code in Dept-001/Fin.Year Format Pin
Vinay Meka11-Dec-12 22:41
Vinay Meka11-Dec-12 22:41 
QuestionRe: Generating Code in Dept-001/Fin.Year Format Pin
Eddy Vluggen12-Dec-12 3:06
professionalEddy Vluggen12-Dec-12 3:06 
AnswerRe: Generating Code in Dept-001/Fin.Year Format Pin
Mycroft Holmes12-Dec-12 11:53
professionalMycroft Holmes12-Dec-12 11:53 
QuestionHow to print an SSRS Report in PDF Format from my asp.net page Pin
Vinay Meka11-Dec-12 17:55
Vinay Meka11-Dec-12 17:55 
Hi guys.,
I had an grid view where i had placed an link button to print an report.In this button click event i need to call the SSRS report and need to get the output as pdf file.
I had used this below code,the code is running fine,but i'm unable to see the prompt to open/save pdf file.Plz reply ASAP.

protected void btnAuthenticateAndPrint_Click(object sender, EventArgs args)
    {
        try
        {
            
            //Getting Values from grid
            LinkButton lb = (LinkButton)sender;
            GridViewRow row = (GridViewRow)lb.NamingContainer;
            Label lbOrderID = row.FindControl("lbOrderID") as Label;
            int OrderId = Convert.ToInt32(lbOrderID.Text);
            da = new SqlDataAdapter("Get_PODetails", con);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@MPDI_ID", OrderId);
            ds = new DataSet();
            da.Fill(ds, "PO");
            if (ds.Tables["PO"].Rows.Count > 0)
            {
                lblPOId.Text=ds.Tables["PO"].Rows[0]["MPDI_ID"].ToString();
                lblVendid.Text = ds.Tables["PO"].Rows[0]["MVDI_ID"].ToString();
                lblBranch.Text = ds.Tables["PO"].Rows[0]["MBRI_ID"].ToString();
                lblDate.Text = Convert.ToDateTime(ds.Tables["PO"].Rows[0]["MPDI_Date"]).ToString("dd-MM-yyyy");
            }

            //SSRS Report Print
            rs = new RSWebService.ReportingService2005();
            rsExec = new REWebService.ReportExecutionService();
            rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
            rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;
            rs.Url = "http://localhost/ReportServer/ReportService2005.asmx";
            rsExec.Url = "http://localhost/ReportServer/ReportExecution2005.asmx";
            byte[] Sendresults = null;
            byte[] bytes = null;
            string historyID = null;
            string deviceInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";
            string format = "PDF";
            string encoding = null;
            string mimeType = null;
            string extension = null;
            REWebService.Warning[] warnings = null;
            string[] streamIDs = null;
            string _reportName = @"/FIMO GOF Assets Reports/PURCHASE ORDER";
            REWebService.ExecutionInfo ei = rsExec.LoadReport(_reportName, historyID);
            REWebService.ParameterValue[] parameters = new REWebService.ParameterValue[4];
            parameters[0] = new REWebService.ParameterValue();
            parameters[0].Name = "MVDI_ID";
            parameters[0].Value = lblVendid.Text;
            parameters[1] = new REWebService.ParameterValue();
            parameters[1].Name = "MBRI_ID";
            parameters[1].Value = lblBranch.Text;
            parameters[2] = new REWebService.ParameterValue();
            parameters[2].Name = "MPDI_Date";
            parameters[2].Value = lblDate.Text;
            parameters[3] = new REWebService.ParameterValue();
            parameters[3].Name = "ReportParameter1";
            parameters[3].Value = lblPOId.Text;
            rsExec.SetExecutionParameters(parameters, "en-us");
            Sendresults = rsExec.Render(format, deviceInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);
            MemoryStream ms = new MemoryStream(Sendresults);


            //To create a PDF
if (format == "PDF")
            {
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-disposition", "inline;filename=output.pdf");
                Response.AddHeader("Content-Length", Sendresults.Length.ToString());
            }
            Response.OutputStream.Write(Sendresults, 0, Sendresults.Length);
            Response.OutputStream.Flush();
            Response.OutputStream.Close();

        }
        catch(Exception Ex)
        {
            throw Ex;
        }
    }


Thanks & Regards,
Vinay
AnswerRe: How to print an SSRS Report in PDF Format from my asp.net page - Crosspost Pin
Richard MacCutchan11-Dec-12 21:30
mveRichard MacCutchan11-Dec-12 21:30 
Questionreading individual files in a database backup set Pin
Danzy8310-Dec-12 22:44
Danzy8310-Dec-12 22:44 
AnswerRe: reading individual files in a database backup set Pin
Corporal Agarn11-Dec-12 3:58
professionalCorporal Agarn11-Dec-12 3:58 
QuestionJava Struts2 Framework Pin
Maheshwari Anand10-Dec-12 2:46
Maheshwari Anand10-Dec-12 2:46 
AnswerRe: Java Struts2 Framework Pin
Mycroft Holmes10-Dec-12 18:39
professionalMycroft Holmes10-Dec-12 18:39 
AnswerRe: Java Struts2 Framework Pin
Richard MacCutchan10-Dec-12 21:39
mveRichard MacCutchan10-Dec-12 21:39 
QuestionSQL Query To select result for monthly Pin
VishwaKL9-Dec-12 22:43
VishwaKL9-Dec-12 22:43 
AnswerRe: SQL Query To select result for monthly Pin
Eddy Vluggen9-Dec-12 23:12
professionalEddy Vluggen9-Dec-12 23:12 
GeneralRe: SQL Query To select result for monthly Pin
VishwaKL9-Dec-12 23:15
VishwaKL9-Dec-12 23:15 
GeneralRe: SQL Query To select result for monthly Pin
Eddy Vluggen9-Dec-12 23:18
professionalEddy Vluggen9-Dec-12 23:18 
GeneralRe: SQL Query To select result for monthly Pin
VishwaKL9-Dec-12 23:20
VishwaKL9-Dec-12 23:20 
GeneralRe: SQL Query To select result for monthly Pin
Eddy Vluggen9-Dec-12 23:24
professionalEddy Vluggen9-Dec-12 23:24 
GeneralRe: SQL Query To select result for monthly Pin
VishwaKL9-Dec-12 23:27
VishwaKL9-Dec-12 23:27 
AnswerRe: SQL Query To select result for monthly Pin
David Mujica10-Dec-12 3:16
David Mujica10-Dec-12 3:16 
GeneralRe: SQL Query To select result for monthly Pin
VishwaKL10-Dec-12 14:48
VishwaKL10-Dec-12 14:48 
GeneralRe: SQL Query To select result for monthly Pin
Shameel10-Dec-12 21:34
professionalShameel10-Dec-12 21:34 
GeneralRe: SQL Query To select result for monthly Pin
J4amieC11-Dec-12 0:11
J4amieC11-Dec-12 0:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.