Showing posts with label example. Show all posts
Showing posts with label example. Show all posts

Friday, March 30, 2012

How can I configure Report Services to show different set of Rendering Extension Per Repor

Hi There,
I'd like to configure the report services rendering extension on a per
report application basis. for example, if i have two report packages
named Package A and Package B, and I'd like to show only "PDF" as the
only export option for Package A, and "Excel" only for Package B. Is
there anyway to achieve this? changing the RSReportServer.config will
affect all report applications on the same server.
Regards,
KevinNo way to do this. Only way would be to have your own application instead of
using Report Manager.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<hodgelai@.yahoo.com> wrote in message
news:1124482992.992758.129540@.z14g2000cwz.googlegroups.com...
> Hi There,
> I'd like to configure the report services rendering extension on a per
> report application basis. for example, if i have two report packages
> named Package A and Package B, and I'd like to show only "PDF" as the
> only export option for Package A, and "Excel" only for Package B. Is
> there anyway to achieve this? changing the RSReportServer.config will
> affect all report applications on the same server.
>
> Regards,
> Kevin
>|||Thanks, Bruce!
Is that doable in SQL 2005?|||Thanks, Bruce!
Is that doable in SQL 2005?|||I don't think so but I don't know for sure.
One thing you could do is disable all export and then on your report have a
link at the top that exports to the format that you want.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<hodgelai@.yahoo.com> wrote in message
news:1124484347.411986.145310@.z14g2000cwz.googlegroups.com...
> Thanks, Bruce!
> Is that doable in SQL 2005?
>

Wednesday, March 28, 2012

How can I check for Null or Empty in an Insert/Select Statement - example in Access

The following sample of code in access is what i need to be able to do in
MSSQL 2000.
Can i use iif statements like this in the select part of the insert if so i
cannot get this to work in MSSQL
iif(IsNull(NBCDON.CODE),"9999",NBCDON.Code),
INSERT INTO dbo_ContactAddress (ContactID, AddressTypeCode, AddressLine1,
AddressLine2, AddressLine3, AddressLine4, AddressLine5,AddressLine6,
CountryCode, Town, PostalCode, State, DoNotMarket, DoNotSell )
SELECT NBCDON.ID+100100000, 1,iif(IsNull(NBCDON.Unit), "",NBCDON.Unit+"/") +
NBCDON.Number +iif(IsNull(NBCDON.suf), "",NBCDON.suf)+ " " + NBCDON.Street
," ", " ", " ", " ", " ",1, iif(IsNull(NBCDON.SubTown),
"?",NBCDON.SubTown) ,iif(IsNull(NBCDON.CODE),"9999",NBCDON.Code),
NBCDON.State, 0, 0
FROM NBCDON
WHERE not IsEmpty(NBCDON.Street)
Regards
Jeff
--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.554 / Virus Database: 346 - Release Date: 20/12/2003I resolved this by Using the IsNul( field, value if null) Expression.
Regards
Jeff
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.554 / Virus Database: 346 - Release Date: 20/12/2003sql

Friday, March 23, 2012

How can I bind to an SqlDataSource from Code

My code behind file builds a select statement and I would like to fill an SqlDataSource control with it. Can some show me an example of how I might do that? Maybe something like this?

Me.SqlDataSourceSearchResult.ConnectionString ="ConnectStr"Me.SqlDataSourceSearchResult.SelectCommand ="SelectStatement"

gvSearchResult.DataSource =

Me.SqlDataSourceSearchResult

gvSearchResult.DataBind()

Hello Jackxxx,

If you are going to be doing this in code-behind, I would not bother with the SqlDataSource control. I would bind the data directly to the destination control as follows: -

Dim conn As New SqlConnection("YourConnectionString")
Dim command As New SqlCommand("SELECT * FROM YourTable", conn)
Dim da As New SqlDataAdapter(command)
Dim tblData As New DataTable
da.Fill(tblData)
conn.close()

gvSearchResult.DataSource = tblData
gvSearchResult.DataBind()

Also add the following 2 lines at the top of the code behind if they are not there already: -

Imports System.Data.SqlClient
Imports System.Data

Kind regards

Scotty

|||

Scotty,

I was trying to use the sqldatasource so that I could some how use its built in sort functionality.

|||

Hello Jackxxx,

I see now. In that case, do the following after populating tblData: -

Dim dvData as new DataView(tblData)

dvData.Sort = "MyField DESC" ' you can also apply filtering on a DataView

mygrid.DataSource = dvData ' binds to the DataView, not the DataTable

mygrid.DataBind()

Kind regards

Scotty

|||

I'm really hoping to find a way to bind to the SqlDataSource so that I can take advantage of sorting and paging for multiple fields without all the extra coding.

There must be a way.

|||

Hi Jack,

Suppose your SqlDataSource returns a DataSet, you can

mygrid.DataSource = sqlDatasource.Select()
mygrid.DataBind()

However, if you need to take advantage of sorting and paging, I suggest you bind with the designer.

Wednesday, March 21, 2012

How can I assign a value to a textbox programmatically in a report?

For example: If I want to display the date today, txtDate.Text = DateToday;Type
=System.DateTime.Now
into the Textbox and set the Format (right-click->properties) to dd.MM.yyyy or your corresponding date-format
|||that's design time, what i'm trying to do is at run-time I want to assign a value to a particular textbox in the report. ΓΌ|||There is no way other than assigning a expression to the Textbox. The "MS Access way" doesn't work anymore ;(
You can do something like:
=iif( some_condition = true, System.DateTime.Now, "No Date")

or create your own function:
Add
Public Function myFunction(val as Object)
if val is Nothing then return System.DateTime.Now
return "Empty"
End Funcion

to Report-Properties->Code
and call it by
=Code.myFunction(Fields!ConditionColumn.Value)

|||ok thanks, i'll try your solution later. sql

Monday, March 19, 2012

How can default schema change in stored procedure ?

Hello,

How can default schema change in stored procedure ?

For Example:

There are two user 'User1', 'User2' in TestDb Database.
These users default schema is same name, like 'User1's default schema is 'User1', and 'User2's default schme is 'User2'.
And each users have 'Table1' table, like [User1].[Table1], [User2].[Table1]

In this enviroment,
query 'SELECT * FROM [Table1]' refer default schema of execute user.
like 'User1' execute 'SELECT * FROM [User1].[Table1]'.

But if dbo create a stored procedure below, default schema doesn't work.

CREATE PROCEDURE SelectTable1
AS
SET NOCOUNT ON
SELECT * FROM Table1
GO

When User1/User2 execute this stored procedure, error happend because Table1 not found.

So, I want to change default schema in stored procedure to current users default schema.
EXECUTE AS CALLER is change current user principal only, this doen't change default schema.

Regards,

This is not possible to do in TSQL right now without using dynamic SQL for the query inside the stored procedure. For EXECUTE AS CALLER the unqualified object names resolve against the schema for the owner of the SP and not the caller. This is known issue and there have been requests to provide the facility to resolve object name against the invoker of the SPs. Oracle for example allows you to specify this when creating PL/SQL SPs.

Monday, March 12, 2012

how ca i do that?

how can i insert an image in a database and how can i show the image for
example in an active server page?Do you have overwhelming and compelling reasons to store the files in the
database, instead of the filesystem?
http://www.aspfaq.com/2149
--
http://www.aspfaq.com/
(Reverse address to reply.)
"qwerty" <pompeighuII@.yahoo.com> wrote in message
news:eTTXSChYEHA.212@.TK2MSFTNGP12.phx.gbl...
> how can i insert an image in a database and how can i show the image for
> example in an active server page?
>
>

How building a report referenced by a map?

I need to create a report with a map that allows me to selece a particular
set of data when I click on a map element.
For example, I have an employee table containing the data related the country.
I want to build a map respect this data. This it is easy.
Then when I click on a particular value of country, the report must load the
data of employee table selecting this value.
Is it possible to do it? Do I must write embedded code?
How can I solve this issue?
Many thanksCheck this out:
http://dspace.dial.pipex.com/town/drive/xxg48/CustomParameters.html
José.
"Pasquale" <Pasquale@.discussions.microsoft.com> wrote in message
news:60EF9D9F-C19C-47BD-9745-2BF5DCB694A8@.microsoft.com...
>I need to create a report with a map that allows me to selece a particular
> set of data when I click on a map element.
> For example, I have an employee table containing the data related the
> country.
> I want to build a map respect this data. This it is easy.
> Then when I click on a particular value of country, the report must load
> the
> data of employee table selecting this value.
> Is it possible to do it? Do I must write embedded code?
> How can I solve this issue?
> Many thanks

Wednesday, March 7, 2012

Hours/minutes in the Calendar date time prompt

Is there any way to get teh date time prompt to display hours & minutes? For example, if I default the field to '=Today', I would like to see '8/10/2006 9:04 AM' instead of '8/10/2006'

Similarly, when I pick a date using the date picker control that is displayed by default, I would like it to also display the time, which I guess would default to 12:00 AM.

Thanks in advance!

I have a report parameter set using :

=DateSerial(Year(now()), Month(now()), 0) that displays the last day of the month as default and when you view the report the end date is populated as:

7/31/2006 12:00:00 AM

does that help?

|||

Hi,

I encountered the same situation once and this is what I did:

in the report parameter --> default values, write the following expression

=today().addseconds(1). This will display the data and time when you run the report. The only thing is that for the default value it will add 1 second.

--Amde

|||

Thanks...your replies got me off on the right path. I ended up using the following:

=DateAdd("h",12,Today)

and

=now

I had been using =Today which just returns a date. Duh.