473,387 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Profile Images

I am trying to make a profile page that displays a user's profile
picture if they have added one. If they haven't added a picture, I want
a hyperlink to link to a page to upload it to the server. I have gotten
an upload page working where it stores the server file path on the
server and the corresponding user in an SQL database and then uploads
the picture. I want the hyperlink to link to a page that deletes the
picture if they have one attached to their profile.

Code of the edit profile page:
Partial Class noanon_editprofile
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim conn, rs, sql, pUser

'Visual Studio 2005 Express Edition made me declare the field
or else it would not build

conn = Server.CreateObject("ADODB.Connection")

'I have a conn.Open statement here and I named the field in the
database pUser because ASP was interpreting the field if it was User,
not SQL. I also have aspcompat=True, btw

sql = "SELECT pUser,FileLocation FROM profilepiclocations WHERE
pUser = 'User.Identity.Name'"
rs = conn.execute(sql)
If rs.Fields.Item(pUser) = User.Identity.Name Then
HyperLink3.Text = "Delete profile picture."
HyperLink3.NavigateUrl = "~/noanon/deletepicture.aspx"
Else
HyperLink3.Text = "Add profile picture."
HyperLink3.NavigateUrl = "~/noanon/uploadpicture.aspx"
End If
conn.Close()
End Sub
End Class

I haven't tried scripting the image tag yet. I have played around with
this code and either it didn't work or it gave me errors, like "Item
cannot be found in the collection corresponding to the requested name
or ordinal." What did I do wrong? Is there a better way do do this
through ASP.NET instead of ADO?
-Mihir

Jul 22 '06 #1
1 1169
Uzytkownik <mi**********@gmail.comnapisal w wiadomosci
news:11**********************@i42g2000cwa.googlegr oups.com...

Firs you declare pUser variable
Dim conn, rs, sql, pUser.
Than, you do not pass anywhere any value to this variable.
sql = "SELECT pUser,FileLocation FROM profilepiclocations WHERE
pUser = 'User.Identity.Name'"
rs = conn.execute(sql)
If rs.Fields.Item(pUser) = User.Identity.Name Then
Here you try to pass pUser variable as a parameter to Item property.
I suppose that you have omited quotation-marks or you have forgotten
to pass value (actually with column name) to pUser variable
ps.
Try to use SqlCommand instead of old-fashioned ADO commands.
--
JS
BRE Bank Dev Team, Poland
Jul 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Shimon Sim | last post by:
Hi I am working on application that need to hold custom user information - Last and first name, email, some other domain related information. I used to create Base class for all my pages. The base...
0
by: Giorgio | last post by:
It seems that the ASP.NET Microsoft team didn't think about this!! The profilemanager class has the following methods: - DeleteInactiveProfiles. Enables you to delete all profiles older...
1
by: Prasanna Pattam | last post by:
I am using Custom Profile and creating the profile in Profile_Personalize event. I am also using sitemap. When a page has a menu control, then the Profile_Personalize event is called 6 - 7 times...
6
by: Jeff | last post by:
Hey (and thank you for reading my post) In visual web developer 2005 express edition I've created a simple website project.. At this website I want users who register to be able to upload a...
9
by: Kirk | last post by:
I have successfully, implemented a custom Membership Provider to a SQL 2000 table, however, I am having problems doing the same with a Profile Provider. As I understand it, the steps for both of...
4
by: Scott M. | last post by:
When profile data is stored in ASP .NET, where is the user data persisted? For how long is it persisted: is it session persisted or permanent (like a cookie)?
3
by: Oriane | last post by:
Hi there, I would like to open my Asp.Net project as a "Web Application" rather than as a "Web Site" in Visual Studio. But the thing is that I use the System.Web.Profile and the auto-generated...
0
by: David Troxell - Encourager Software | last post by:
Product Scope 7 (http://www.encouragersoftware.com/) and Profile Exchanges enhanced with SetupCast publishing methods NOTE: If you are a software author, releasing commercial and/or shareware...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.