Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Dispalying Welcome User to logged in user

Reply
Thread Tools

Dispalying Welcome User to logged in user

 
 
mark
Guest
Posts: n/a
 
      10-06-2005
Hello

I want to display on a webpage Welcome Mark to a logged in user. Users login
using their email address but I want to display their Name from the same
table which stores email and password. Here is the code I'm using but it
doesn't work.

Sub Page_Load
Dim conMyData As SqlConnection
Dim cmdSelect As SqlCommand

conMyData = New SqlConnection(
"Server=mtsda;UID=user;PWD=password;Database=B AOL" ) conMyData.Open()
cmdSelect = New SqlCommand("Select Login_Name From Provider_Login where (
Provider_Email = <%=User.Identity.Name%>) ", conMyData )
lblLogin_Name.Text = cmdSelect.ExecuteScalar()
conMyData.Close()
End Sub

Appreciate your Help


 
Reply With Quote
 
 
 
 
S.M. Altaf [MVP]
Guest
Posts: n/a
 
      10-06-2005
Try this:

Sub Page_Load
Dim conMyData As SqlConnection
Dim cmdSelect As SqlCommand
conMyData = New
SqlConnection("Server=mtsda;UID=user;PWD=password; Database=BAOL" )
conMyData.Open()
cmdSelect = New SqlCommand("Select Login_Name From Provider_Login where
(Provider_Email = '" & User.Identity.Name & "')", conMyData )
lblLogin_Name.Text = cmdSelect.ExecuteScalar()
conMyData.Close()
End Sub

HTH
S.M. Altaf
[MVP - VB]

--------------------------------------------------------------------------------
All that glitters has a high refractive index.
www.mendhak.com


"mark" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello
>
> I want to display on a webpage Welcome Mark to a logged in user. Users
> login using their email address but I want to display their Name from the
> same table which stores email and password. Here is the code I'm using but
> it doesn't work.
>
> Sub Page_Load
> Dim conMyData As SqlConnection
> Dim cmdSelect As SqlCommand
>
> conMyData = New SqlConnection(
> "Server=mtsda;UID=user;PWD=password;Database=B AOL" ) conMyData.Open()
> cmdSelect = New SqlCommand("Select Login_Name From Provider_Login where
> ( Provider_Email = <%=User.Identity.Name%>) ", conMyData )
> lblLogin_Name.Text = cmdSelect.ExecuteScalar()
> conMyData.Close()
> End Sub
>
> Appreciate your Help
>



 
Reply With Quote
 
 
 
 
mark
Guest
Posts: n/a
 
      10-07-2005
Thank you for your reply. It's still not working. I'm not getting any error
on my page but I'm not getting User Name either . I'm using the following
code on the page: Welcome <asp:label ID="lblLogin_Name" Runat="server"/> to
dispaly the name in the HTML portion of the page - however all I'm getting
is Welcome.
I know I've DB connection I'm authenticated and I'm getting no errors.
What could be wrong?

Mark

"S.M. Altaf [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Try this:
>
> Sub Page_Load
> Dim conMyData As SqlConnection
> Dim cmdSelect As SqlCommand
> conMyData = New
> SqlConnection("Server=mtsda;UID=user;PWD=password; Database=BAOL" )
> conMyData.Open()
> cmdSelect = New SqlCommand("Select Login_Name From Provider_Login where
> (Provider_Email = '" & User.Identity.Name & "')", conMyData )
> lblLogin_Name.Text = cmdSelect.ExecuteScalar()
> conMyData.Close()
> End Sub
>
> HTH
> S.M. Altaf
> [MVP - VB]
>
> --------------------------------------------------------------------------------
> All that glitters has a high refractive index.
> www.mendhak.com
>
>
> "mark" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hello
>>
>> I want to display on a webpage Welcome Mark to a logged in user. Users
>> login using their email address but I want to display their Name from the
>> same table which stores email and password. Here is the code I'm using
>> but it doesn't work.
>>
>> Sub Page_Load
>> Dim conMyData As SqlConnection
>> Dim cmdSelect As SqlCommand
>>
>> conMyData = New SqlConnection(
>> "Server=mtsda;UID=user;PWD=password;Database=B AOL" ) conMyData.Open()
>> cmdSelect = New SqlCommand("Select Login_Name From Provider_Login where
>> ( Provider_Email = <%=User.Identity.Name%>) ", conMyData )
>> lblLogin_Name.Text = cmdSelect.ExecuteScalar()
>> conMyData.Close()
>> End Sub
>>
>> Appreciate your Help
>>

>
>



 
Reply With Quote
 
naijacoder naijacoder
Guest
Posts: n/a
 
      10-07-2005
Are you using Windows Authenetication?
Patrick



*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
mark
Guest
Posts: n/a
 
      10-07-2005
No The authentication is via SQL 2000 Table.

"naijacoder naijacoder" <(E-Mail Removed)> wrote in message
news:%23Qux%(E-Mail Removed)...
> Are you using Windows Authenetication?
> Patrick
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dispalying data in a cell in gridview =?Utf-8?B?TWlrZQ==?= ASP .Net 2 08-28-2007 01:34 PM
Serious issue: parts of my page render as not logged in, parts as logged in. Help! pcloches@gmail.com ASP .Net 1 04-12-2007 12:50 AM
Dispalying asp pages ASP .Net 10 04-19-2006 06:42 AM
LoginView does not show a logged in user as being logged in keithb ASP .Net 0 02-16-2006 05:20 PM
browser & dispalying of "frames" ...D. HTML 44 07-26-2004 09:57 AM



Advertisments