Showing posts with label inside. Show all posts
Showing posts with label inside. Show all posts

Friday, March 30, 2012

Problem running stored procedure inside another store procedure

hi,

I want to use a stored procedure inside a stored procedure simulteanously changing the database.
this is my base store procedure

alter PROCEDURE create_file @.dbname sysname
AS
declare @.fname varchar(30)
declare @.fsizes nvarchar
BEGIN
DECLARE @.cmd varchar(1000)
set @.cmd = 'osql -E -d ' + @.dbname + ' -Q "exec ret_sizes @.fname OUTPUT,@.fsizes OUTPUT"'
exec master..xp_cmdshell @.cmd
END

if i execute the his "exec create_file ertis"
i get error as

Msg 137, Level 15, State 2, Server HCC-BPVHD1, Line 1
Must declare the variable '@.fname'.
NULL

the procedure called inside the mail procedure is

alter procedure ret_sizes
@.fname varchar(30) OUTPUT,
@.fsizes nvarchar OUTPUT
as
begin
select @.fname=name, @.fsizes=size from sysfiles
order by fileid
end

Please help meThe @.Cmd string doesn't seem to include the second exec.

set @.cmd = 'osql -E -d ' + @.dbname + ' + '-Q' + ' "exec ret_sizes @.fname OUTPUT,@.fsizes OUTPUT"' '

exec @.CMD

__________________________________________________ ___________

Quote:

Originally Posted by eRTIS SQL

hi,

I want to use a stored procedure inside a stored procedure simulteanously changing the database.
this is my base store procedure

alter PROCEDURE create_file @.dbname sysname
AS
declare @.fname varchar(30)
declare @.fsizes nvarchar
BEGIN
DECLARE @.cmd varchar(1000)
set @.cmd = 'osql -E -d ' + @.dbname + ' -Q "exec ret_sizes @.fname OUTPUT,@.fsizes OUTPUT"'
exec master..xp_cmdshell @.cmd
END

if i execute the his "exec create_file ertis"
i get error as

Msg 137, Level 15, State 2, Server HCC-BPVHD1, Line 1
Must declare the variable '@.fname'.
NULL

the procedure called inside the mail procedure is

alter procedure ret_sizes
@.fname varchar(30) OUTPUT,
@.fsizes nvarchar OUTPUT
as
begin
select @.fname=name, @.fsizes=size from sysfiles
order by fileid
end

Please help me

sql

Problem returning HTMLEncoded text.

I am storing HTML inside a text field already HTMLEncoded. (example.
<body>) When I use the FOR XML EXPLICIT to return this field I get
&lt;body&gt; My text is being HTMLEncoded again.
Is there a way to prevent this from happening?
Thanks,
Ryan
Not to my knowledge, FOR XML automatically does the encoding.
Irwin Dolobowsky
Program Manager - SqlXml
http://weblogs.asp.net/irwando
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ryan Fiorini" <ryan.fiorini@.mutualofamerica.com> wrote in message
news:#o5U#iyFEHA.684@.tk2msftngp13.phx.gbl...
> I am storing HTML inside a text field already HTMLEncoded. (example.
> <body>) When I use the FOR XML EXPLICIT to return this field I get
> &lt;body&gt; My text is being HTMLEncoded again.
> Is there a way to prevent this from happening?
> Thanks,
> Ryan
>
|||Try to use the !xml directive in your FOR XML explicit query. This should
avoid entitization.
Best regards
Michael
"Irwin Dolobowsky[MS]" <irwind@.mail.microsoft.com> wrote in message
news:%233U1zw3FEHA.1600@.tk2msftngp13.phx.gbl...
> Not to my knowledge, FOR XML automatically does the encoding.
> --
> Irwin Dolobowsky
> Program Manager - SqlXml
> http://weblogs.asp.net/irwando
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Ryan Fiorini" <ryan.fiorini@.mutualofamerica.com> wrote in message
> news:#o5U#iyFEHA.684@.tk2msftngp13.phx.gbl...
get
>
sql

Wednesday, March 28, 2012

Problem returning a timestamp column inside an TSQL Transaction

I cannot manage to fetch the new timestamp value inside a TSQL Transaction. I have tried to Select "@.LastChanged" before committing the transaction and after committing the transaction. A TimestampCheck variable is used to get the timestamp value of the Custom Business Object. It is checked against the row updating to see if they match. If they do, the Update begins as a Transaction. I send @.LastChanged (timestamp) and an InputOutput param, But I also have the same problem sending in a dedicated timestamp param ("@.NewLastChanged"):

1select @.TimestampCheck = LastChangedfrom ADD_Addresswhere AddressId=@.AddressId23if @.TimestampCheckisnull4begin5RAISERROR ('AddressId does not exist in ADD_Address: E002', 16, 1)-- AddressId does not exist.6return -17end8 else if @.TimestampCheck <> @.LastChanged9begin10RAISERROR ('Timestamps do not match up, the record has been changed: E003', 16, 1)11return -112end131415Begin Tran Address1617Update ADD_Address18set StreetNumber= @.StreetNumber, AddressLine1=@.AddressLine1, StreetTypeId=@.StreetTypeId, AddressLine2=@.AddressLine2, AddressLine3=@.AddressLine3, CityId=@.CityId, StateProvidenceId=@.StateProvidenceId, ZipCode=@.ZipCode, CreateId=@.CreateId, CreateDate=@.CreateDate19where AddressId= @.AddressId2021select @.error_code =@.@.ERROR, @.AddressId= scope_identity()2223if @.error_code = 024begin25commit tran Address2627select @.LastChanged = LastChanged28from ADD_Address29where AddressId = @.AddressId3031if @.LastChangedisnull32begin33RAISERROR ('LastChanged has returned null in ADD_Address: E004', 16, 1)34return -135end36if @.LastChanged = @.TimestampCheck37begin38RAISERROR ('LastChanged original value has not changed in ADD_Address: E005', 16, 1)39return -140end41return 0
I do not have this problem if I do not use a TSQL Transaction. Is there a way to capture the new timestamp inside a Transaction, or have I missed something?
Thank you,
jspurlin 

No need for a transaction for that really. Just go about it a different way:

Update {fields} FROM {table} WHEREAddressID=@.AddressID ANDLastChanged=@.LastChanged

Then get the number of records affected, and the error codes.

if there were no errors, and no rows were affected then you can either raise a generic error ('record changed or does not exist'), or you can go and look and see which of the two (AddressID,LastChanged) didn't exist, although there is the possability the data may change between the update and when you go and try to figure out why it failed, in which case you may get an incorrect error message (Saying it didn't exist, when it was only changed or saying it was changed when it didn't exist).

Problem Retrieving @@Identity when inside a transaction.

I'm using transactions with my SqlConnection ( sqlConnection.BeginTransaction() ).
I do an Insert into my User table, and then subsequently use thegenerated identity ( via @.@.identity ) to make an insert into anothertable. The foreign key relationship is dependant on the generatedidentity. For some reason with transactions, I can't retrieve theinsert identity (it always returns as 1). However, I need theinserts to be under a transaction so that one cannot succeed while theother fails. Does anyone know a way around this problem?
So heres a simplefied explanation of what I'm trying to do:
Begin Transaction
Insert into User Table
Retrieve Inserted Identity (userID) via @.@.Identity
Insert into UserContact table, using userID as the foreign key.
Commit Transaction.
Because of the transaction, userID is 1, therefore an insert cannot bemade into the UserContact table because of the foreign key constraint.
I need this to be a transaction in case one or the other fails. Any ideas??


Try using Scope_Identity() instead of @.@.IDENTITY and see if that solvesyour problem. Scope_Identity will give you the last identityvalue generated in your current scope.
|||I tried using Scope_Identity() and I'm getting the exact same problem.
|||I can tell you that I just tried out your scenario and it worked withno problem for me. I tried it both wrapped in a transaction andnot. So there is something particular about your code that iscausing the problem. Could you post it here?
|||Fixed it. Had nothing to do with transactions. Stupid error on my part.
It seems as though I forgot to encapsulate my sql insert procedure in aBegin / End block, so that when I performed an insert it returned 1instead of the @.@.Identity which was on the next line.
Thanks for trying to help! Much appreciated =D
|||I'm glad you got it sorted. Be sure to use Scope_Identity()instead of @.@.IDENTITY. If at some point in the future, e.g., atrigger is added to your table which inserts a record into some table,@.@.IDENTITY will contain the Identity value of that inserted record, andthat's not what you want.

Monday, March 26, 2012

problem rendering a logo (external static image)

Hi,
I am having a problem rendering a logo, which is inside my asp.net
application, but first let me clear out what is exactly what I want to do and
what I have been able to do:
I am using soap access to render reports in our asp.net application, and it
works well (aside from a performance issue which I have not yet looked at).
The reports contain a logo, and it gets displayed pretty well. So basically,
everything is working.
The problem resides in that we wont be giving external access to Reporting
Services and the url of the images being displayed are pointing to reporting
services. I know there is a work around, since I could configure it as an
embedded image, and then use the render stream method of the web service. I
want to avoid doing so, since it is just a simple static image, which is
already rendered on the asp.net application. If I do so, I will have to deal
with creating temporary copies of it, and then deleting them (which I dont
know when to ... but that is another story).
So, the question is: is there a simple way to render the report in such a
way the image url the browser receive is that of the static file saved in our
asp.net application? if so, will exporting to other formats keep working
normally?I have been digging about the issue, and I dont seem to find any way to do
what I wanna do, in fact it seems that not being able to show external images
directly
from their source is by design ...
so, I am stuck with the normal routes ... I did find around in the boards,
how I can do it without ever writting the images to disk ... here, the post
before the last one
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=uzmGLaeAEHA.3316%40TK2MSFTNGP11.phx.gbl&rnum=1&prev=/groups%3Fq%3Daspx%2Bimage%2Bgroup:*.reportingsvcs%2Bauthor:teo%26hl%3Den%26lr%3D%26ie%3DUTF-8%26scoring%3Dd%26selm%3DuzmGLaeAEHA.3316%2540TK2MSFTNGP11.phx.gbl%26rnum%3D1
In normal use of images it sounds pretty great, but I am concerned in my
case this might unnecesarily degrade performance (since I would be calling
the web service per image served, even if it is an already server image to
that client ... and it is a logo that appears on every page ... and the
report is showing all pages), even more than saving a copy of the static
image per client to the server, and then figuring out when to delete them
(and the way it is showed on the thread I posted above, doesnt help either
... because it assumes the image will get served once, and mine gets served
several times ...)
I would highly appreciate any lights in this, since I am in the dark ...
a couple comments:
to be honest, altough I undestand security implications I am not sure if it
solves the problem more than making devs lifes harder (I usually dont make
this type of comment :P :(:( ) ...
(*) One can render the report trough Soap access and get the images from rs,
then one is the server, in fact as long as u use the same generated id that u
get from the render call, u can even serve the image from a different
location (and setting the streamroot appropiately) ... in fact when using it
trough Soap access u can more easily mess with the reports itself (mess as
modify :P) ... this is a pretty good reason why restricting truly external
images when rendering in HTML trough soap access doesnt make any sense, it
isnt adding any degree of security ... in my opinion ...

Problem Registering Existing Server

I am trying to reregister an existing server that we've been able to
register previously.
I can successfully register it inside the network, i.e., from another
workstation on the network, but when I try to register via a gateway, i.e.,
over the internet I can't. I can ping the server, and the router has port
forwarding setup correctly (port 1433), I've turned off the firewall, and
nothing else has changed that I am aware of, but it just won't respond. I
am confident that the SA password is correct.
I'm stumped. I have remote users who need to access this server, but can't
get in.
Can anyone give me any suggestions. I've tried everything I can imagine.
The one change on this system is that we had to reinstall the Server, and
we've installed CA Antivirus. But I've uninstalled the CA firewall
software, and turned off the Windows Firewall (just to get this up...we had
it running before with SQL traffic allowed).
Any Ideas are welcome!!
Bob
Hi Bob
"Bob Bartel" wrote:

> I am trying to reregister an existing server that we've been able to
> register previously.
> I can successfully register it inside the network, i.e., from another
> workstation on the network, but when I try to register via a gateway, i.e.,
> over the internet I can't. I can ping the server, and the router has port
> forwarding setup correctly (port 1433), I've turned off the firewall, and
> nothing else has changed that I am aware of, but it just won't respond. I
> am confident that the SA password is correct.
> I'm stumped. I have remote users who need to access this server, but can't
> get in.
> Can anyone give me any suggestions. I've tried everything I can imagine.
> The one change on this system is that we had to reinstall the Server, and
> we've installed CA Antivirus. But I've uninstalled the CA firewall
> software, and turned off the Windows Firewall (just to get this up...we had
> it running before with SQL traffic allowed).
> Any Ideas are welcome!!
> Bob
>
It would be safer to use a VPN for this rather than leaving the server open.
http://support.microsoft.com/kb/287932 describes the communication between
the client and server, make sure you are using TCP/IP protcols and the client
is not blocking the returning traffic. If you have set up this correctly you
should be in-undated with people trying to hack in.
John
|||As I mentioned, I have already had this working before. And only shut down
my firewall for this test. I agree a VPN is a good choice and I'll probably
turn it on, but...
But the real problem is that even with the router correctly forwarding 1433
and the firewall configured to allow the traffic, I can't register the
server remotely.
The only thing I can think of that may be effecting it is that I had to
reinstall the server. Can anyone think of anything that would keep remote
users from registering with a new install? Is there some setting on the
server that I neglected to turn back on?
Bob
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:5E55FAA1-601D-4DED-8E5C-0324E2ED46B6@.microsoft.com...
> Hi Bob
> "Bob Bartel" wrote:
> It would be safer to use a VPN for this rather than leaving the server
> open.
> http://support.microsoft.com/kb/287932 describes the communication between
> the client and server, make sure you are using TCP/IP protcols and the
> client
> is not blocking the returning traffic. If you have set up this correctly
> you
> should be in-undated with people trying to hack in.
> John
|||Hi
"Bob Bartel" wrote:

> As I mentioned, I have already had this working before. And only shut down
> my firewall for this test. I agree a VPN is a good choice and I'll probably
> turn it on, but...
> But the real problem is that even with the router correctly forwarding 1433
> and the firewall configured to allow the traffic, I can't register the
> server remotely.
> The only thing I can think of that may be effecting it is that I had to
> reinstall the server. Can anyone think of anything that would keep remote
> users from registering with a new install? Is there some setting on the
> server that I neglected to turn back on?
> Bob
>
If this is SQL Express you may not have turned on remote access. If this is
a named instance then it would not be using the default ports.
John
|||Its a named instance...where to I specify the port?
bob
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:1B0EB2A5-8E12-41C2-9D87-5C38176D1783@.microsoft.com...
> Hi
> "Bob Bartel" wrote:
> If this is SQL Express you may not have turned on remote access. If this
> is
> a named instance then it would not be using the default ports.
> John
|||Hi Bob
"Bob Bartel" wrote:

> Its a named instance...where to I specify the port?
> bob
In the SQL Server Configuration manager there will be an entry in the SQL
Server 2005 Network Configuration branch for your instance. This will shows
which protocols are installed and enabled. Right clicking TCP/IP and choosing
properties and on the IP Address tab you can set the protocol to be enabled
and also set the port. You will need to make sure that there are no other
instances using this port.
John

Problem Registering Existing Server

I am trying to reregister an existing server that we've been able to
register previously.
I can successfully register it inside the network, i.e., from another
workstation on the network, but when I try to register via a gateway, i.e.,
over the internet I can't. I can ping the server, and the router has port
forwarding setup correctly (port 1433), I've turned off the firewall, and
nothing else has changed that I am aware of, but it just won't respond. I
am confident that the SA password is correct.
I'm stumped. I have remote users who need to access this server, but can't
get in.
Can anyone give me any suggestions. I've tried everything I can imagine.
The one change on this system is that we had to reinstall the Server, and
we've installed CA Antivirus. But I've uninstalled the CA firewall
software, and turned off the Windows Firewall (just to get this up...we had
it running before with SQL traffic allowed).
Any Ideas are welcome!!
BobHi Bob
"Bob Bartel" wrote:
> I am trying to reregister an existing server that we've been able to
> register previously.
> I can successfully register it inside the network, i.e., from another
> workstation on the network, but when I try to register via a gateway, i.e.,
> over the internet I can't. I can ping the server, and the router has port
> forwarding setup correctly (port 1433), I've turned off the firewall, and
> nothing else has changed that I am aware of, but it just won't respond. I
> am confident that the SA password is correct.
> I'm stumped. I have remote users who need to access this server, but can't
> get in.
> Can anyone give me any suggestions. I've tried everything I can imagine.
> The one change on this system is that we had to reinstall the Server, and
> we've installed CA Antivirus. But I've uninstalled the CA firewall
> software, and turned off the Windows Firewall (just to get this up...we had
> it running before with SQL traffic allowed).
> Any Ideas are welcome!!
> Bob
>
It would be safer to use a VPN for this rather than leaving the server open.
http://support.microsoft.com/kb/287932 describes the communication between
the client and server, make sure you are using TCP/IP protcols and the client
is not blocking the returning traffic. If you have set up this correctly you
should be in-undated with people trying to hack in.
John|||As I mentioned, I have already had this working before. And only shut down
my firewall for this test. I agree a VPN is a good choice and I'll probably
turn it on, but...
But the real problem is that even with the router correctly forwarding 1433
and the firewall configured to allow the traffic, I can't register the
server remotely.
The only thing I can think of that may be effecting it is that I had to
reinstall the server. Can anyone think of anything that would keep remote
users from registering with a new install? Is there some setting on the
server that I neglected to turn back on?
Bob
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:5E55FAA1-601D-4DED-8E5C-0324E2ED46B6@.microsoft.com...
> Hi Bob
> "Bob Bartel" wrote:
>> I am trying to reregister an existing server that we've been able to
>> register previously.
>> I can successfully register it inside the network, i.e., from another
>> workstation on the network, but when I try to register via a gateway,
>> i.e.,
>> over the internet I can't. I can ping the server, and the router has
>> port
>> forwarding setup correctly (port 1433), I've turned off the firewall,
>> and
>> nothing else has changed that I am aware of, but it just won't respond.
>> I
>> am confident that the SA password is correct.
>> I'm stumped. I have remote users who need to access this server, but
>> can't
>> get in.
>> Can anyone give me any suggestions. I've tried everything I can imagine.
>> The one change on this system is that we had to reinstall the Server, and
>> we've installed CA Antivirus. But I've uninstalled the CA firewall
>> software, and turned off the Windows Firewall (just to get this up...we
>> had
>> it running before with SQL traffic allowed).
>> Any Ideas are welcome!!
>> Bob
> It would be safer to use a VPN for this rather than leaving the server
> open.
> http://support.microsoft.com/kb/287932 describes the communication between
> the client and server, make sure you are using TCP/IP protcols and the
> client
> is not blocking the returning traffic. If you have set up this correctly
> you
> should be in-undated with people trying to hack in.
> John|||Hi
"Bob Bartel" wrote:
> As I mentioned, I have already had this working before. And only shut down
> my firewall for this test. I agree a VPN is a good choice and I'll probably
> turn it on, but...
> But the real problem is that even with the router correctly forwarding 1433
> and the firewall configured to allow the traffic, I can't register the
> server remotely.
> The only thing I can think of that may be effecting it is that I had to
> reinstall the server. Can anyone think of anything that would keep remote
> users from registering with a new install? Is there some setting on the
> server that I neglected to turn back on?
> Bob
>
If this is SQL Express you may not have turned on remote access. If this is
a named instance then it would not be using the default ports.
John|||Its a named instance...where to I specify the port?
bob
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:1B0EB2A5-8E12-41C2-9D87-5C38176D1783@.microsoft.com...
> Hi
> "Bob Bartel" wrote:
>> As I mentioned, I have already had this working before. And only shut
>> down
>> my firewall for this test. I agree a VPN is a good choice and I'll
>> probably
>> turn it on, but...
>> But the real problem is that even with the router correctly forwarding
>> 1433
>> and the firewall configured to allow the traffic, I can't register the
>> server remotely.
>> The only thing I can think of that may be effecting it is that I had to
>> reinstall the server. Can anyone think of anything that would keep
>> remote
>> users from registering with a new install? Is there some setting on the
>> server that I neglected to turn back on?
>> Bob
>>
> If this is SQL Express you may not have turned on remote access. If this
> is
> a named instance then it would not be using the default ports.
> John|||Hi Bob
"Bob Bartel" wrote:
> Its a named instance...where to I specify the port?
> bob
In the SQL Server Configuration manager there will be an entry in the SQL
Server 2005 Network Configuration branch for your instance. This will shows
which protocols are installed and enabled. Right clicking TCP/IP and choosing
properties and on the IP Address tab you can set the protocol to be enabled
and also set the port. You will need to make sure that there are no other
instances using this port.
John

Problem Registering Existing Server

I am trying to reregister an existing server that we've been able to
register previously.
I can successfully register it inside the network, i.e., from another
workstation on the network, but when I try to register via a gateway, i.e.,
over the internet I can't. I can ping the server, and the router has port
forwarding setup correctly (port 1433), I've turned off the firewall, and
nothing else has changed that I am aware of, but it just won't respond. I
am confident that the SA password is correct.
I'm stumped. I have remote users who need to access this server, but can't
get in.
Can anyone give me any suggestions. I've tried everything I can imagine.
The one change on this system is that we had to reinstall the Server, and
we've installed CA Antivirus. But I've uninstalled the CA firewall
software, and turned off the Windows Firewall (just to get this up...we had
it running before with SQL traffic allowed).
Any Ideas are welcome!!
BobHi Bob
"Bob Bartel" wrote:

> I am trying to reregister an existing server that we've been able to
> register previously.
> I can successfully register it inside the network, i.e., from another
> workstation on the network, but when I try to register via a gateway, i.e.
,
> over the internet I can't. I can ping the server, and the router has port
> forwarding setup correctly (port 1433), I've turned off the firewall, and
> nothing else has changed that I am aware of, but it just won't respond. I
> am confident that the SA password is correct.
> I'm stumped. I have remote users who need to access this server, but can'
t
> get in.
> Can anyone give me any suggestions. I've tried everything I can imagine.
> The one change on this system is that we had to reinstall the Server, and
> we've installed CA Antivirus. But I've uninstalled the CA firewall
> software, and turned off the Windows Firewall (just to get this up...we ha
d
> it running before with SQL traffic allowed).
> Any Ideas are welcome!!
> Bob
>
It would be safer to use a VPN for this rather than leaving the server open.
http://support.microsoft.com/kb/287932 describes the communication between
the client and server, make sure you are using TCP/IP protcols and the clien
t
is not blocking the returning traffic. If you have set up this correctly you
should be in-undated with people trying to hack in.
John|||As I mentioned, I have already had this working before. And only shut down
my firewall for this test. I agree a VPN is a good choice and I'll probably
turn it on, but...
But the real problem is that even with the router correctly forwarding 1433
and the firewall configured to allow the traffic, I can't register the
server remotely.
The only thing I can think of that may be effecting it is that I had to
reinstall the server. Can anyone think of anything that would keep remote
users from registering with a new install? Is there some setting on the
server that I neglected to turn back on?
Bob
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:5E55FAA1-601D-4DED-8E5C-0324E2ED46B6@.microsoft.com...
> Hi Bob
> "Bob Bartel" wrote:
>
> It would be safer to use a VPN for this rather than leaving the server
> open.
> http://support.microsoft.com/kb/287932 describes the communication between
> the client and server, make sure you are using TCP/IP protcols and the
> client
> is not blocking the returning traffic. If you have set up this correctly
> you
> should be in-undated with people trying to hack in.
> John|||Hi
"Bob Bartel" wrote:

> As I mentioned, I have already had this working before. And only shut dow
n
> my firewall for this test. I agree a VPN is a good choice and I'll probab
ly
> turn it on, but...
> But the real problem is that even with the router correctly forwarding 143
3
> and the firewall configured to allow the traffic, I can't register the
> server remotely.
> The only thing I can think of that may be effecting it is that I had to
> reinstall the server. Can anyone think of anything that would keep remote
> users from registering with a new install? Is there some setting on the
> server that I neglected to turn back on?
> Bob
>
If this is SQL Express you may not have turned on remote access. If this is
a named instance then it would not be using the default ports.
John|||Its a named instance...where to I specify the port?
bob
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:1B0EB2A5-8E12-41C2-9D87-5C38176D1783@.microsoft.com...
> Hi
> "Bob Bartel" wrote:
>
> If this is SQL Express you may not have turned on remote access. If this
> is
> a named instance then it would not be using the default ports.
> John|||Hi Bob
"Bob Bartel" wrote:

> Its a named instance...where to I specify the port?
> bob
In the SQL Server Configuration manager there will be an entry in the SQL
Server 2005 Network Configuration branch for your instance. This will shows
which protocols are installed and enabled. Right clicking TCP/IP and choosin
g
properties and on the IP Address tab you can set the protocol to be enabled
and also set the port. You will need to make sure that there are no other
instances using this port.
John

Friday, March 9, 2012

Problem loading satellite assemblies in RS2000

Hi,

I have a problem calling Assembly.GetSatelliteAssembly inside a custom assembly referenced by a report. This assembly is used only for localization, and all it does is load the appropriate localized satellite assembly and pull a translated string out of it. The problem doesn't manifest itself if the report is viewed by a user that has higher privileges, but for a user with only the Browser role the GetSatelliteAssembly method throws a System.IO.FileLoadException "Access is denied: Resources.resources" (the custom assembly is called Resources.dll).

The assembly has no strong key and has the AllowPartiallyTrustedCallers attribute in AssemblyInfo. I did set fullTrust in the rssrvpolicy.config, like this:

<CodeGroup
class="FirstMatchCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="TestCodeGroup"
Description="A special code group for my custom assembly.">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin\Resources.dll"/>
</CodeGroup>

I even tried asserting a FileIOPermission on the satellite dll prior to calling GetSatelliteAssemblies: the assert succeeds but the problem remains.

I'm using RS2000 SP2 with the whatsit hotfix (build no. 1402, IIRC). Note that this exception doesn't seem to appear if I try the same report in RS2005, but migrating is currently not an option.

What should I do? If this is a bug in RS2000 is there a workaround? Any suggestions are welcome.

Thanks in advance!
The old rule has proven true again, the answer comes by itself once you post the question to others...

The fusion log showed that GetSatelliteAssembly searches for the satellite dll in the ReportServer/bin folder, but also in Temporary ASP.Net Files... So, one part of the solution was to give the user modify permission on it. The other part was to give him read permission on the satellite assembly - and this is strange because the main assembly doesn't require extra permissions, but the satellite assembly does.

I'm sure I'm not seeing the big picture here, so if someone can shed any amount of light () on this issue, it would be appreciated.