Hey guys,
I would like to determine the network id of the current user so that I can
pass that value to a stored procedure that the report references.
I tried add the following code in the Code tab of the Report Properties tab:
Function GetUserID() AS String
Return System.Environment.UserName
End Function
I then referenced this function as the default value for the @.vcUserId
argument that the stored procedure wants by assigning =Code.GetUserID() as
the Non-queried default value for the report parameter.
This approach works well when I preview the report in Visual Studio.
Unfortunately, it fails when I deploy the report to the server.
Can anyone offer some suggestions on how to approach this issue?
Thanks in advance,
-JimI'd guess that the reason this doesn't work is because when you run it
in VS.net the application is running as you or some other acceptable
local user
(http://msdn2.microsoft.com/en-us/library/system.environment.username.aspx).
When it runs online it probably can't execute or it returns the
ASP.NET worker process's user or something similar and not useful. I
know for ASP.NET you can call HttpContext.User.Idenity.Name (or
something similar, I'm working from memory mostly) to see who the
logged in user is, this might work better in report services. Or there
might be a separate way to get the current user from the report manager
that I'm not aware of.|||Use the global variable User!UserID.value
You can get to this with the expression builder. It returns domain\username,
if you don't want the domain then you will need to strip it off.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Terence Tirella" <ttirella@.literate.com> wrote in message
news:1141851303.988200.237700@.u72g2000cwu.googlegroups.com...
> I'd guess that the reason this doesn't work is because when you run it
> in VS.net the application is running as you or some other acceptable
> local user
> (http://msdn2.microsoft.com/en-us/library/system.environment.username.aspx).
> When it runs online it probably can't execute or it returns the
> ASP.NET worker process's user or something similar and not useful. I
> know for ASP.NET you can call HttpContext.User.Idenity.Name (or
> something similar, I'm working from memory mostly) to see who the
> logged in user is, this might work better in report services. Or there
> might be a separate way to get the current user from the report manager
> that I'm not aware of.
>sql
Showing posts with label userid. Show all posts
Showing posts with label userid. Show all posts
Thursday, March 22, 2012
Friday, February 17, 2012
design pattern question
Say I have an object that can be created by some users and not others. And, I have a method something like -function createObject(userId as Integer, objectName as String). The method calls a stored procedure using the two input arguments as parameters.
Now, what I am wondering is this; I am obviously going to check in my SP to ensure that the user has the rights to create the new object before inserting the new record, and there will be an output parameter to send the new record ID back to the method, but do I
a) have a separate output parameter to report on the success of the creation (e.g. @.Err Int OUTPUT)
b) use the existing output (used to send the new record ID back) and send an error code (e.g. if newRecordId = -9999)
c) somehow try to cause a failure of the SP that can be caught in a try/catch block
Thanks in advance,
MartinI would use option #2. Since you already have this variable, it can easily be checked for an error code and Im sure you are probably doing other types of checks as well. I would never ever ever use option #3. try/catches should always only be used from true exceptions. I always send myself an error email when a catch is experienced and would always be receiving these emails when there really wasnt an error.
Nick
Now, what I am wondering is this; I am obviously going to check in my SP to ensure that the user has the rights to create the new object before inserting the new record, and there will be an output parameter to send the new record ID back to the method, but do I
a) have a separate output parameter to report on the success of the creation (e.g. @.Err Int OUTPUT)
b) use the existing output (used to send the new record ID back) and send an error code (e.g. if newRecordId = -9999)
c) somehow try to cause a failure of the SP that can be caught in a try/catch block
Thanks in advance,
MartinI would use option #2. Since you already have this variable, it can easily be checked for an error code and Im sure you are probably doing other types of checks as well. I would never ever ever use option #3. try/catches should always only be used from true exceptions. I always send myself an error email when a catch is experienced and would always be receiving these emails when there really wasnt an error.
Nick
Design issue
Anybody have an idea on this.
I currently have a DB with 2 tables.
TableUser
TableInfo
With fields like:
TableUser = UserID, Name, Phone
TableInfo = UserID, comments, status
The user table has the users main info, the info table has some other misc.
info.
I need a way for each user to have a different set of custom fields that
links to the info table.
So I was thinking about adding 2 new tables named TableCustomFields and
TableCustomData.
The TableCustomField would hold the specific users custom fields and have
fields like
CustID
UserID This would link to the induividual user
FieldName This would be the custom field name
DataID This would link to the tableCustomData with the actual data for the
field
The TableCustomData would hold the data for that custom field and have
fields like
CustID This field would link to the field name row
InfoID This filed would link to the info table row
Data This would be the actual data in the custom field
Does this sound right to anybody, or is there a better way to accomplish
what I'm looking for.
I have to keep in mind that I will need to be able to get a users info
table data along with their custom fields and data and display it all in a
row as effieciently as possible.
Thanks for any help
Hi,
Since this is a consultation type issue, you can contact Advisory Services
(AS) . Microsoft Advisory Services provides short-term advice and guidance
for problems not covered by Problem Resolution Service as well as requests
for consultative assistance for design, development and deployment issues.
You may call this number to get Advisory Services: (800) 936-5200.
It is hard to say which design will be the best practise for your sceanrio.
You may also combine FieldName and FieldValue in one table in case you need
the query faster and the volumn of Filed is not so high.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
I currently have a DB with 2 tables.
TableUser
TableInfo
With fields like:
TableUser = UserID, Name, Phone
TableInfo = UserID, comments, status
The user table has the users main info, the info table has some other misc.
info.
I need a way for each user to have a different set of custom fields that
links to the info table.
So I was thinking about adding 2 new tables named TableCustomFields and
TableCustomData.
The TableCustomField would hold the specific users custom fields and have
fields like
CustID
UserID This would link to the induividual user
FieldName This would be the custom field name
DataID This would link to the tableCustomData with the actual data for the
field
The TableCustomData would hold the data for that custom field and have
fields like
CustID This field would link to the field name row
InfoID This filed would link to the info table row
Data This would be the actual data in the custom field
Does this sound right to anybody, or is there a better way to accomplish
what I'm looking for.
I have to keep in mind that I will need to be able to get a users info
table data along with their custom fields and data and display it all in a
row as effieciently as possible.
Thanks for any help
Hi,
Since this is a consultation type issue, you can contact Advisory Services
(AS) . Microsoft Advisory Services provides short-term advice and guidance
for problems not covered by Problem Resolution Service as well as requests
for consultative assistance for design, development and deployment issues.
You may call this number to get Advisory Services: (800) 936-5200.
It is hard to say which design will be the best practise for your sceanrio.
You may also combine FieldName and FieldValue in one table in case you need
the query faster and the volumn of Filed is not so high.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
Labels:
database,
design,
fields,
idea,
liketableuser,
microsoft,
mysql,
oracle,
phonetableinfo,
server,
sql,
tables,
tableusertableinfowith,
userid
Design issue
Anybody have an idea on this.
I currently have a DB with 2 tables.
TableUser
TableInfo
With fields like:
TableUser = UserID, Name, Phone
TableInfo = UserID, comments, status
The user table has the users main info, the info table has some other misc.
info.
I need a way for each user to have a different set of custom fields that
links to the info table.
So I was thinking about adding 2 new tables named TableCustomFields and
TableCustomData.
The TableCustomField would hold the specific users custom fields and have
fields like
CustID
UserID This would link to the induividual user
FieldName This would be the custom field name
DataID This would link to the tableCustomData with the actual data for the
field
The TableCustomData would hold the data for that custom field and have
fields like
CustID This field would link to the field name row
InfoID This filed would link to the info table row
Data This would be the actual data in the custom field
Does this sound right to anybody, or is there a better way to accomplish
what I'm looking for.
I have to keep in mind that I will need to be able to get a users info
table data along with their custom fields and data and display it all in a
row as effieciently as possible.
Thanks for any helpHi,
Since this is a consultation type issue, you can contact Advisory Services
(AS) . Microsoft Advisory Services provides short-term advice and guidance
for problems not covered by Problem Resolution Service as well as requests
for consultative assistance for design, development and deployment issues.
You may call this number to get Advisory Services: (800) 936-5200.
It is hard to say which design will be the best practise for your sceanrio.
You may also combine FieldName and FieldValue in one table in case you need
the query faster and the volumn of Filed is not so high.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.
I currently have a DB with 2 tables.
TableUser
TableInfo
With fields like:
TableUser = UserID, Name, Phone
TableInfo = UserID, comments, status
The user table has the users main info, the info table has some other misc.
info.
I need a way for each user to have a different set of custom fields that
links to the info table.
So I was thinking about adding 2 new tables named TableCustomFields and
TableCustomData.
The TableCustomField would hold the specific users custom fields and have
fields like
CustID
UserID This would link to the induividual user
FieldName This would be the custom field name
DataID This would link to the tableCustomData with the actual data for the
field
The TableCustomData would hold the data for that custom field and have
fields like
CustID This field would link to the field name row
InfoID This filed would link to the info table row
Data This would be the actual data in the custom field
Does this sound right to anybody, or is there a better way to accomplish
what I'm looking for.
I have to keep in mind that I will need to be able to get a users info
table data along with their custom fields and data and display it all in a
row as effieciently as possible.
Thanks for any helpHi,
Since this is a consultation type issue, you can contact Advisory Services
(AS) . Microsoft Advisory Services provides short-term advice and guidance
for problems not covered by Problem Resolution Service as well as requests
for consultative assistance for design, development and deployment issues.
You may call this number to get Advisory Services: (800) 936-5200.
It is hard to say which design will be the best practise for your sceanrio.
You may also combine FieldName and FieldValue in one table in case you need
the query faster and the volumn of Filed is not so high.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.
Labels:
database,
design,
fields,
idea,
liketableuser,
microsoft,
mysql,
oracle,
phonetableinfo,
server,
sql,
tables,
tableusertableinfowith,
userid
Design issue
Anybody have an idea on this.
I currently have a DB with 2 tables.
TableUser
TableInfo
With fields like:
TableUser = UserID, Name, Phone
TableInfo = UserID, comments, status
The user table has the users main info, the info table has some other misc.
info.
I need a way for each user to have a different set of custom fields that
links to the info table.
So I was thinking about adding 2 new tables named TableCustomFields and
TableCustomData.
The TableCustomField would hold the specific users custom fields and have
fields like
CustID
UserID This would link to the induividual user
FieldName This would be the custom field name
DataID This would link to the tableCustomData with the actual data for the
field
The TableCustomData would hold the data for that custom field and have
fields like
CustID This field would link to the field name row
InfoID This filed would link to the info table row
Data This would be the actual data in the custom field
Does this sound right to anybody, or is there a better way to accomplish
what I'm looking for.
I have to keep in mind that I will need to be able to get a users info
table data along with their custom fields and data and display it all in a
row as effieciently as possible.
Thanks for any helpHi,
Since this is a consultation type issue, you can contact Advisory Services
(AS) . Microsoft Advisory Services provides short-term advice and guidance
for problems not covered by Problem Resolution Service as well as requests
for consultative assistance for design, development and deployment issues.
You may call this number to get Advisory Services: (800) 936-5200.
It is hard to say which design will be the best practise for your sceanrio.
You may also combine FieldName and FieldValue in one table in case you need
the query faster and the volumn of Filed is not so high.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
I currently have a DB with 2 tables.
TableUser
TableInfo
With fields like:
TableUser = UserID, Name, Phone
TableInfo = UserID, comments, status
The user table has the users main info, the info table has some other misc.
info.
I need a way for each user to have a different set of custom fields that
links to the info table.
So I was thinking about adding 2 new tables named TableCustomFields and
TableCustomData.
The TableCustomField would hold the specific users custom fields and have
fields like
CustID
UserID This would link to the induividual user
FieldName This would be the custom field name
DataID This would link to the tableCustomData with the actual data for the
field
The TableCustomData would hold the data for that custom field and have
fields like
CustID This field would link to the field name row
InfoID This filed would link to the info table row
Data This would be the actual data in the custom field
Does this sound right to anybody, or is there a better way to accomplish
what I'm looking for.
I have to keep in mind that I will need to be able to get a users info
table data along with their custom fields and data and display it all in a
row as effieciently as possible.
Thanks for any helpHi,
Since this is a consultation type issue, you can contact Advisory Services
(AS) . Microsoft Advisory Services provides short-term advice and guidance
for problems not covered by Problem Resolution Service as well as requests
for consultative assistance for design, development and deployment issues.
You may call this number to get Advisory Services: (800) 936-5200.
It is hard to say which design will be the best practise for your sceanrio.
You may also combine FieldName and FieldValue in one table in case you need
the query faster and the volumn of Filed is not so high.
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to:
Comments (Atom)