Showing posts with label page. Show all posts
Showing posts with label page. Show all posts

Monday, March 26, 2012

How can i print a ssrs report from a aspx page without opening the report

Hello friends

How can i print a ssrs report from a aspx page without opening the report in viewer

I need to print the report when the user clicks on the print button

Thank you

Sara

Please.....Can somebody help.

Sara

|||You'll need to use the ssrs web service. I don't know the details, but it's in the MS book online.|||

Thanks dr_99 , I will look into it

regards Sara

How can I print a field that is in the dataset on each page and show the table hearder on each p

How can I print a field that is in the dataset on each page? I added a textbox in the Page Header and use =Fields!ProjectName.value in the value property. I got an error "Fields cannot used in page header and footer."

How can I have the table header shows on each page? Currently if the data goes to the second page, there is no table header.

Thanks.

DanYeung

Hello Dan,

For the table header, right click on the row and go to properties. Change the RepeatOnNewPage property to True.

For the data field, you can add a textbox in your report header and reference the field by the textbox name that it is located in. Like this:

=First(ReportItems!TextBox9.Value)

Hope this helps.

Jarret

|||

Hi Jarret,

Thanks for your help. I took care the table header.

For the data field, I added a textbox in the body and the value is =Fields!vchrProjectName.Value . I made the textbox invisible. I also added a textbox in the page header and the value is =First(ReportItems!TextBox9.Value) as you suggested. It printed on the first page only. I think the textbox in the body has no value on the second page, so the textbox in the page header got noghting. What did I missed? Do I have put something in the RepeatWith property?

Thanks.

DanYeung

|||

I fixed the page header problem by adding one more table header row before the table header. Added a textbox on the row and used =Fields!ProjectName.value in the value property. Thanks for the idea.

DanYeung

|||

I have the same issue and I tried your suggestion by adding the text box in the body and reference that in the page header. Only the first page work, not others. Any other suggestions or I did something wrong?

Regards

Eric

|||

You have to add a table in the body. Select the table header row. Change the RepeatOnNewPage property to true. Change the table header background color to while. Add a textbox on the table header and add the field in the textbox. Adding the textbox in the body prints only once. You need the table.

DanYeung

|||

Forgive me, I don't understant the second last statement. "Adding the textbox in the body prints only once". Can you explain a little bit more? Also, why to change background color to white?

Best Regards,

Eric

|||

Adding a textbox directly in the body won't print on the second page. If you want to repeat on every page, you have to add a table. The default background color for table header is grey. You don't have to change to white if you prefer grey.

DanYeung

|||

Hey I couldn't find an easy fix so what I would up doing was creating a report parameter set it as internal so it did not prompt when the report was being created and then for available and default values i selected it as a "from query" and pulled the value from there (with a linked dataset). Works like a charm for me in preview and exporting to PDFs. Here is the XML view of the report I created pulling fields, EmpName, MgrName and EmpPosition as EmpName, MgrName, and Position. The name of my dataset is dsGoals.

Code Snippet

<ReportParameter Name="EmpName">

<DataType>String</DataType>

<DefaultValue>

<DataSetReference>

<DataSetName>dsGoals</DataSetName>

<ValueField>EmpName</ValueField>

</DataSetReference>

</DefaultValue>

<AllowBlank>true</AllowBlank>

<ValidValues>

<DataSetReference>

<DataSetName>dsGoals</DataSetName>

<ValueField>EmpName</ValueField>

</DataSetReference>

</ValidValues>

</ReportParameter>

<ReportParameter Name="MgrName">

<DataType>String</DataType>

<DefaultValue>

<DataSetReference>

<DataSetName>dsGoals</DataSetName>

<ValueField>MgrName</ValueField>

</DataSetReference>

</DefaultValue>

<AllowBlank>true</AllowBlank>

<ValidValues>

<DataSetReference>

<DataSetName>dsGoals</DataSetName>

<ValueField>MgrName</ValueField>

</DataSetReference>

</ValidValues>

</ReportParameter>

<ReportParameter Name="Position">

<DataType>String</DataType>

<DefaultValue>

<DataSetReference>

<DataSetName>dsGoals</DataSetName>

<ValueField>EmpPosition</ValueField>

</DataSetReference>

</DefaultValue>

<AllowBlank>true</AllowBlank>

<ValidValues>

<DataSetReference>

<DataSetName>dsGoals</DataSetName>

<ValueField>EmpPosition</ValueField>

</DataSetReference>

</ValidValues>

</ReportParameter>

How can I print a field that is in the dataset on each page and show the table hearder on each p

How can I print a field that is in the dataset on each page? I added a textbox in the Page Header and use =Fields!ProjectName.value in the value property. I got an error "Fields cannot used in page header and footer."

How can I have the table header shows on each page? Currently if the data goes to the second page, there is no table header.

Thanks.

DanYeung

Hello Dan,

For the table header, right click on the row and go to properties. Change the RepeatOnNewPage property to True.

For the data field, you can add a textbox in your report header and reference the field by the textbox name that it is located in. Like this:

=First(ReportItems!TextBox9.Value)

Hope this helps.

Jarret

|||

Hi Jarret,

Thanks for your help. I took care the table header.

For the data field, I added a textbox in the body and the value is =Fields!vchrProjectName.Value . I made the textbox invisible. I also added a textbox in the page header and the value is =First(ReportItems!TextBox9.Value) as you suggested. It printed on the first page only. I think the textbox in the body has no value on the second page, so the textbox in the page header got noghting. What did I missed? Do I have put something in the RepeatWith property?

Thanks.

DanYeung

|||

I fixed the page header problem by adding one more table header row before the table header. Added a textbox on the row and used =Fields!ProjectName.value in the value property. Thanks for the idea.

DanYeung

|||

I have the same issue and I tried your suggestion by adding the text box in the body and reference that in the page header. Only the first page work, not others. Any other suggestions or I did something wrong?

Regards

Eric

|||

You have to add a table in the body. Select the table header row. Change the RepeatOnNewPage property to true. Change the table header background color to while. Add a textbox on the table header and add the field in the textbox. Adding the textbox in the body prints only once. You need the table.

DanYeung

|||

Forgive me, I don't understant the second last statement. "Adding the textbox in the body prints only once". Can you explain a little bit more? Also, why to change background color to white?

Best Regards,

Eric

|||

Adding a textbox directly in the body won't print on the second page. If you want to repeat on every page, you have to add a table. The default background color for table header is grey. You don't have to change to white if you prefer grey.

DanYeung

|||

Hey I couldn't find an easy fix so what I would up doing was creating a report parameter set it as internal so it did not prompt when the report was being created and then for available and default values i selected it as a "from query" and pulled the value from there (with a linked dataset). Works like a charm for me in preview and exporting to PDFs. Here is the XML view of the report I created pulling fields, EmpName, MgrName and EmpPosition as EmpName, MgrName, and Position. The name of my dataset is dsGoals.

Code Snippet

<ReportParameter Name="EmpName">

<DataType>String</DataType>

<DefaultValue>

<DataSetReference>

<DataSetName>dsGoals</DataSetName>

<ValueField>EmpName</ValueField>

</DataSetReference>

</DefaultValue>

<AllowBlank>true</AllowBlank>

<ValidValues>

<DataSetReference>

<DataSetName>dsGoals</DataSetName>

<ValueField>EmpName</ValueField>

</DataSetReference>

</ValidValues>

</ReportParameter>

<ReportParameter Name="MgrName">

<DataType>String</DataType>

<DefaultValue>

<DataSetReference>

<DataSetName>dsGoals</DataSetName>

<ValueField>MgrName</ValueField>

</DataSetReference>

</DefaultValue>

<AllowBlank>true</AllowBlank>

<ValidValues>

<DataSetReference>

<DataSetName>dsGoals</DataSetName>

<ValueField>MgrName</ValueField>

</DataSetReference>

</ValidValues>

</ReportParameter>

<ReportParameter Name="Position">

<DataType>String</DataType>

<DefaultValue>

<DataSetReference>

<DataSetName>dsGoals</DataSetName>

<ValueField>EmpPosition</ValueField>

</DataSetReference>

</DefaultValue>

<AllowBlank>true</AllowBlank>

<ValidValues>

<DataSetReference>

<DataSetName>dsGoals</DataSetName>

<ValueField>EmpPosition</ValueField>

</DataSetReference>

</ValidValues>

</ReportParameter>

Friday, March 23, 2012

how can I post back a statement from a store procedure to the .aspx page

Hi all,
Anyone can show me how can I catch the 'Print' statement that I have defined in my store procedure using SQL server 2000 DB on the .aspx page? ( I am using ASP.NET 1.0)
My store procedure as follow:
CREATE PROC NewAcctType
(@.acctType VARCHAR(20))
AS
BEGIN
--checks if the new account type is already exist
IF EXISTS (SELECT * FROM AcctTypeCatalog WHERE acctType = @.acctType)
BEGIN
PRINT 'The account type is already exist'
RETURN
END

BEGIN TRANSACTION
INSERT INTO AcctTypeCatalog (acctType) VALUES (@.acctType)

--if there is an error on the insertion, rolls back the transaction; otherwise, commits the transaction
IF @.@.error <> 0 OR @.@.rowcount <> 1
BEGIN
ROLLBACK TRANSACTION
PRINT 'Insertion failure on AcctTypeCatalog table.'
RETURN
END
ELSE
BEGIN
COMMIT TRANSACTION
END
END
Thanks for all your replies

The best thing to do would be to either create another parameter and set its type to output or return the statement as a select.
@.message varchar(100) output
set @.message = 'The account type is already exists'
or
select 'The account type is already exist' as message

Nick

|||Hi Nick,
As you stated:
@.message varchar(100) output
set @.message = 'The account type is already exists'
Do I put a return statement like "Return @.message"?
How about if there is no errror in the procedure, do I still need to return any value to the .aspx page?
Thanks.|||Hi Nick,
when I executed my store procedure in SQL 2000 server, I got an error said"Cannot use the OUTPUT option in a DECLARE statement"
But without the Declare keyword, I got an incorrect syntax error, so how can I solve this problem? Is that necessary to put the "output" keyword at the end of the declare varaible statement?
Thanks|||syntax is:
create procedure whateverName
@.message varchar(100) output
as
set @.message = ''
if @.@.ERROR
set @.message = 'your text here.'
If you have no error, the top set statement will allow a blank to be passed back.
Nick|||

Nick,
Here is my syntax:
CREATE PROC DeleteCust
(@.SSN VARCHAR(12), @.message VARCHAR(40) output)
AS
BEGIN

--checks if the SSN is already exist
IF NOT EXISTS (SELECT * FROM Customer WHERE SSN = @.SSN)
BEGIN
SET @.message = 'The SSN is not exist!'
RETURN
END
BEGIN TRANSACTION
DELETE FROM Customer WHERE SSN = @.SSN

--if there is an error on the delete, rolls back the transaction; otherwise, commits the transaction
IF @.@.error <> 0 OR @.@.rowcount <> 1
BEGIN
ROLLBACK TRANSACTION
SET @.message = 'Delete failure on Customer table.'
RETURN
END
ELSE
BEGIN
COMMIT TRANSACTION
END
END


I executed this proc as:
declare @.message VARCHAR(40)
exec deleteCust '111-11-1111', @.message output
Given that SSN is invalid, I suppose got the message 'The SSN is not exist!", however, I didn't get that message from the execution instead the system message showed "The command(s) completed successfully.", so anywhere I was wrong with the above SP or the execute statement?
Appreciated your reply

|||

If your just looking for the value after a run in QA, add:

declare @.message VARCHAR(40)
exec deleteCust '111-11-1111', @.message output
select @.message
Nick

|||

Thanks nick. I got the message when I run the Store Procedure in SQL server. However, how can I get the error message when I called the Store Procedure on my .aspx page?
I have these codes on my page: ('DeleteCust' is my store procedure name, 'SSN.Text' is the value from the input box)
myConnection = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("ConnectionString"));

var myCommand : SqlDataAdapter = new SqlDataAdapter("DeleteCust", myConnection);
myCommand.SelectCommand.CommandType = CommandType.StoredProcedure;

myCommand.SelectCommand.Parameters.Add(new SqlParameter("@.SSN", SqlDbType.VarChar, 12)).Value = SSN.Text;
Then, what should I put it here to catch the @.message value? The @.message is VARCHAR, and I have a Return keyword within my procedure, and the return value type is INT?
ping

|||

Add (Code is in VB):

dim parm as new sqlParameter("@.message", sqlDBtype.varchar, 100)

parm.direction = ParameterDirection.Output
myCommand.SelectCommand.Parameters.Add(parm)
After you do your call to stored proc:
strMessage(Or whatever variable you are adding to) = myCommand.SelectCommand.Parameters(1).Value
Nick

|||Hi Nick,
Could u explain more detail for these statements coz I am new to doing asp, I want to know it more about the meaning of those codes.
parm.direction = ParameterDirection.Output
strMessage(what variable should I add it here? could u give me an example? are u talking about @.message?)
when do I use strMessage() ?
Many thanks.

|||

Here is a quick and dirty article on output parms.

http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=624

Nick

How can I place the data region in center of the report page?

Hi, all here,

Would please anyone here give me any guidance for placing the data region in the center of the report page?

Thanks a lot in advance for any guidance and help for that.

With best regards,

Yours sincerely,

PS: I am using Microsoft SQL Server 2005 reporting server.

Other than using the margins I do not know of a way. If you find one I'm interested to hear it.|||

Hi,used the tags for it. But how can I know the valid elements and all valid values for the elements supported in the XML code? It is strange that some child elements used under some tags are not supported in other tags.

But we can add user-defined tags to XML, why here it dose not work then? Thanks a lot for any guidance and help for that.

With best regards,

Yours sincerely,

|||

Hi,

I'm pretty new to all this reporting services stuff so you'll have to forgive me if I've misinterpreted your question and I'm making no sense at all.

I had the same problem and the only way I could get around it was to first of all set my page width and height in report properties to roughly the same size as my physical page - for A4 say 30cm X 21cm, then set the body of the report to the same width as I specified in report properties (all this is from the layout tab).

Next I set my left and right margins to zero before dragging my report layout/textbox or whatever the correct name for them is to the centre of the body. This is quite easy as there's the centre marker on the textbox when selected, which I used to line up with the rule guide at the top of the page.

When previewed the report content should be centred on the page. Hope this helps, but like I say, I'm new to this stuff so I may have grabbed hold of the wrong stick, let alone the wrong end of the stick.

All the best,

Chris

|||

Hi, Chris, thanks a lot.

Yeap, I did try to modify the margin properties. It worked out as you guided. Thanks a lot.

With best regards,

Yours sincerely,

sql

How can I place a value from my dataset into the page header?

My report has a parameter of "End_Date" which is used to create my dataset from a stored procedure. In the dataset, a column called "Begin_Date" is returned with various other information used in the report creation.

Currently, the parameter "End_Date" is used in the page header as part of my report title. My user's whould also like to see the "Begin_Date" value in the page header.

Both End and Begin dates are unique values occuring once per report run. How do I get the "Begin_Date" contained in my dataset as a value to be displayed in the page header title?

many thanks

The current method is to add a hidden text box to the body with that value. Then reference that text box value in the page header.

In future releases we are looking at adding field references to the other page sections.

|||

Thank you Brad for the response. Please excuse my lack of understanding. In the Page header, any time I reference a field in the body I get a message basically saying "Fields can not be used in any page headers or footers".

I have tried placing a hidden text box in the body with the value and referencing it in the page header, but with no success. I continue to receive the "Fields can not be used in any page headers or footers" error message.

Have I misunderstood your response? thanks

|||

you need to give reference like these for the header textbox

=ReportItems!txtReportHeader.Value

where txtReportHeader is the text box in the body, which contains the value of the dataset field

|||

Thanks rakam, it worked like a charm....

I didn't realize you could reference ReportItems from headers and footers. Appreciate the information.

How can I place a value from a dataset into the page header?

Hello,

I know that I can do it through:

1. A hidden parameter

2. Report Items

The first method is not good for my report because I have another application that renders the report to a PDF.

And the second method I cannot refer more than one report item and I need to refer two items.

Is there any other method that I can use?

Thanks,

Abdel

Abdel,

I believe that those are your only options, I use the parameter trick and I'm able to export successfully to PDF. Can you state why this is failing?

Ham

Wednesday, March 21, 2012

how can i mapped the sql data to the ms access db?

I need to create an ASP.Net page that connects to an MS SQL server as its
dbase. But the MS SQL server is really connecting to an MS Access db to get
the data.How can I mapped the data of the ms access db so that when my ms
sql server connects it can get the data and display the data in my ASP.net
page.
thanksHi
Is there a linked server created to communicate with Access database?
Please refer to the BOL (Linked servers) .
"cEciLlE" <cecille.regidor@.gmail.com> wrote in message
news:%23c8TSgiEFHA.3824@.TK2MSFTNGP10.phx.gbl...
> I need to create an ASP.Net page that connects to an MS SQL server as its
> dbase. But the MS SQL server is really connecting to an MS Access db to
get
> the data.How can I mapped the data of the ms access db so that when my ms
> sql server connects it can get the data and display the data in my ASP.net
> page.
> thanks
>

Monday, March 12, 2012

how can i insert, retrieve date from ASPX page in table ?

hello all

pls tell me

how can i insert, retrieve date from ASPX(vs2003) page in table in sql server 2000??

i m in trouble

pls help me

Please do not use the ASP.NET Forums to get others to do your work for you. The questions you have been asking show that you are not eventrying to work it out yourself.

What you need to do is useGoogle to research the topic. Then, using that research, have a go at writing the code you need. If that code fails, and you have spent more than ten minutes trying to fix it yourself, show us the code and explain what you are trying to do and how it is failing.

You should also considering buying a good book with which to learn ASP.NET: ASP.NETUnleashed, Second Edition.

Sunday, February 19, 2012

How Can I generate a rdl file from a mdx query in VB.net or C#.net?

Is there some methods to generate the rdl file or reporting html page from a given mdx query language
For instance, I have a mdx query:
select dim1.a on rows, dim2.b on columns from cub1
How can I generate the corresponding rdl file to generate report html page with VB.net or C#.net?

I know that one can use xmltextwriter to write the rdl file but it is a difficult work.Is there some internal class in Vistual Studio have some methods to generate the rdl file?

Thanks

There's a good article here on this:

http://msdn2.microsoft.com/en-us/library/ms167274.aspx

There's also some 3rd party libraries out there.

http://www.rdlcomponents.com/