Showing posts with label username. Show all posts
Showing posts with label username. Show all posts

Monday, March 26, 2012

Proper use of the Right Function

RIGHT(value, numberofchars)
select right(username, 6) from ...
Seems like a reference to Books Online would have done this for you much
more efficiently than a forum post. :-)
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net
"fiaola" <fiaola@.mail.com> wrote in message
news:O9fJ6tLVIHA.5448@.TK2MSFTNGP04.phx.gbl...
> Hi,
> I tried to use the right function as, "Select right(UserName) as UN from
> Table1" and it returned "blank".
> It works well with Left. Im puzzled.
> Thanks
>
"fiaola" <fiaola@.mail.com> wrote in message
news:uIiqWJuVIHA.1184@.TK2MSFTNGP04.phx.gbl...
> Thanks for the reply. I did that, but it returned blank values. If i
> tried the LEFT function, it works well.
> My field is a character, and I could not figure out why it does not pickup
> the parameters requested.
>
What is the username you're using?
Perhaps the 6 right most characters are blank?
Can you post the actual code.
Thanks.

> "TheSQLGuru" <kgboles@.earthlink.net> wrote in message
> news:13ogib06s428b79@.corp.supernews.com...
>
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html

Proper use of the Right Function

Hi,
I tried to use the right function as, "Select right(UserName) as UN from
Table1" and it returned "blank".
It works well with Left. Im puzzled. :)
ThanksRIGHT(value, numberofchars)
select right(username, 6) from ...
Seems like a reference to Books Online would have done this for you much
more efficiently than a forum post. :-)
--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net
"fiaola" <fiaola@.mail.com> wrote in message
news:O9fJ6tLVIHA.5448@.TK2MSFTNGP04.phx.gbl...
> Hi,
> I tried to use the right function as, "Select right(UserName) as UN from
> Table1" and it returned "blank".
> It works well with Left. Im puzzled. :)
> Thanks
>|||Thanks for the reply. I did that, but it returned blank values. If i tried
the LEFT function, it works well.
My field is a character, and I could not figure out why it does not pickup
the parameters requested.
"TheSQLGuru" <kgboles@.earthlink.net> wrote in message
news:13ogib06s428b79@.corp.supernews.com...
> RIGHT(value, numberofchars)
> select right(username, 6) from ...
> Seems like a reference to Books Online would have done this for you much
> more efficiently than a forum post. :-)
> --
> Kevin G. Boles
> Indicium Resources, Inc.
> SQL Server MVP
> kgboles a earthlink dt net
>
> "fiaola" <fiaola@.mail.com> wrote in message
> news:O9fJ6tLVIHA.5448@.TK2MSFTNGP04.phx.gbl...
>> Hi,
>> I tried to use the right function as, "Select right(UserName) as UN from
>> Table1" and it returned "blank".
>> It works well with Left. Im puzzled. :)
>> Thanks
>|||"fiaola" <fiaola@.mail.com> wrote in message
news:uIiqWJuVIHA.1184@.TK2MSFTNGP04.phx.gbl...
> Thanks for the reply. I did that, but it returned blank values. If i
> tried the LEFT function, it works well.
> My field is a character, and I could not figure out why it does not pickup
> the parameters requested.
>
What is the username you're using?
Perhaps the 6 right most characters are blank?
Can you post the actual code.
Thanks.
> "TheSQLGuru" <kgboles@.earthlink.net> wrote in message
> news:13ogib06s428b79@.corp.supernews.com...
>> RIGHT(value, numberofchars)
>> select right(username, 6) from ...
>> Seems like a reference to Books Online would have done this for you much
>> more efficiently than a forum post. :-)
>> --
>> Kevin G. Boles
>> Indicium Resources, Inc.
>> SQL Server MVP
>> kgboles a earthlink dt net
>>
>> "fiaola" <fiaola@.mail.com> wrote in message
>> news:O9fJ6tLVIHA.5448@.TK2MSFTNGP04.phx.gbl...
>> Hi,
>> I tried to use the right function as, "Select right(UserName) as UN from
>> Table1" and it returned "blank".
>> It works well with Left. Im puzzled. :)
>> Thanks
>>
>
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html

Friday, March 23, 2012

prompted for username and password

hi,
I've a .net app written to view reports. The app is set up in iis
with the anonymous access checked and integrated windows
authentication checked for the default web site (my app - it's a
dedicated web server) and the same with the Reports and ReportServer
virtual directories within the Default Web Site.
I can get to my app's start page fine and browse the site I've
written, but when I try to view a report from the app I am prompted
for a username and password. Why is this and how can I get rid of
it'
I've added new roles for everyone and iusr_<machinename> but still I
can't get rid of these prompts.
Any ideas'
Gearóidlook at internet explorer configuration. Security / Intranet / and deselect
"Ask for..."
"Gearoid" wrote:
> hi,
> I've a .net app written to view reports. The app is set up in iis
> with the anonymous access checked and integrated windows
> authentication checked for the default web site (my app - it's a
> dedicated web server) and the same with the Reports and ReportServer
> virtual directories within the Default Web Site.
> I can get to my app's start page fine and browse the site I've
> written, but when I try to view a report from the app I am prompted
> for a username and password. Why is this and how can I get rid of
> it'
> I've added new roles for everyone and iusr_<machinename> but still I
> can't get rid of these prompts.
> Any ideas'
> Gearóid
>|||Thanks for the suggestion but that doesn't seem to be the problem. If
I run the report server from my own machine and try to access reports
from other machines accross the network there's no problem. But if I
deploy the reports to a web server (still on the same network) I get
prompted for the username / password.
Does this sound like a firewall issue with the web server? Or an IIS
issue? Or a Report Server Config issue?
I am truly stumpted here...
"LeCroix" <LeCroix@.discussions.microsoft.com> wrote in message news:<4B95B3D1-745F-4D8F-A127-5EEA073F7626@.microsoft.com>...
> look at internet explorer configuration. Security / Intranet / and deselect
> "Ask for..."
> "Gearoid" wrote:
> > hi,
> >
> > I've a .net app written to view reports. The app is set up in iis
> > with the anonymous access checked and integrated windows
> > authentication checked for the default web site (my app - it's a
> > dedicated web server) and the same with the Reports and ReportServer
> > virtual directories within the Default Web Site.
> >
> > I can get to my app's start page fine and browse the site I've
> > written, but when I try to view a report from the app I am prompted
> > for a username and password. Why is this and how can I get rid of
> > it'
> >
> > I've added new roles for everyone and iusr_<machinename> but still I
> > can't get rid of these prompts.
> >
> > Any ideas'
> >
> > Gearóid
> >

Saturday, February 25, 2012

Programaticly setting the value of a Select Query Property.

I have a query in which I'd like to use the username of the user currently logged in. The expression im using to retrieve the username is: Membership.GetUser().UserName.
Currently I have the following:
<asp:SqlDataSource ID="ProjectSource" runat="server" ConnectionString="<%$ ConnectionStrings:Code %>"
ProviderName="<%$ ConnectionStrings:Code.ProviderName %>" SelectCommand="Select Name, Namespace from Project where User = $Username">
<SelectParameters>
<asp:Parameter DefaultValue="" Name="$Username" />
</SelectParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" DataSourceID="ProjectSource" />

I'd somehow like to set up $Username to be equivlent to Membership.GetUser().UserName.I'd be interested to hear of a better way, however, currently, I cheat. I stuff things like that when they authenticate to session variables (I only have 3 in my current project). Then I pull them in the sqldatasources from there.|||Yeah, my solution doesnt look to be much better. Currently Im Setting the default value every time I need to execute a query.