Last post Feb 03, 2006 01:45 PM by redapples
Jan 27, 2006 10:38 PM|trav1514|LINK
Jan 27, 2006 10:58 PM|MorningZ|LINK
The SQL statement is not working
Something like SELECT username, email from ASPNER_Users WHERE username = loginname. I can't get it to work. Any help would be appreciated.
Can you help others help you? define what "is not working" means? does it mean you get an error? no results? something else?
Jan 28, 2006 03:31 PM|trav1514|LINK
The gridview looks like this:
Loginname1 is the name of a loginname control on the page. It displays the value of username. The gridview does not return anything when the WHERE clause is used and I'm trying to set it to the loginname control. I get a parser
error, 'The server tag is not well formed'. If I set the where clause equal to a username, i.e.,
WHERE (aspnet_Users.UserName = 'Tom' )">, then the gridview works. Otherwise, I get the error. I hope this helps. Thanks.
Feb 02, 2006 03:00 PM|redapples|LINK
I experience a similar problem. I have a Datagrid displaying the results of a view bound datasource. I get results unless I use a Where clause. The clause I have
used is also on UserName.
SelectCommand="SELECT [ProviderName], [Vacancies], [wet] FROM [vw_aspnet_UNamePNameVacc] WHERE ([UserName] <> @UserName)">
<asp:ProfileParameter Name="UserName" PropertyName="UserName" Type="String" />
This returns all the results I need when I configure it and test the query but of course there I am providing the value to compare against. I suspect that the UserName
Property is not being filled. I suspect in the OP example that the control Loginname1 cannot be referenced in that way - if I use the wizard to configure the Where clause I cannot reference a control of that type on my page. Where am I/we going wrong? How
can the Select Command get the profile UserName? I've also tried to use Session User.Identity.Name to no effect either. As far as I can ascertain the ProfileParameters refer to System.Web.Profile.DefaultProfile so how does this relate to a logged in user?
Feb 03, 2006 01:45 PM|redapples|LINK
[code]Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Session("UserName") = Membership.GetUser().UserName
Should do the trick.