Hey,
I am using the following web method to retreive users details:-
public class Person{
public string user_id, username, password, email, avatar, date_added, real_name, location, website, occupation, interests, forum_posts;}
[WebMethod(Description = "This web method will display the profile of specific users.")]public Person User_Details(int id){
Person user = new Person();const string connStr = "Provider=Microsoft.Jet.OleDb.4.0; " + "Data Source=|DataDirectory|forum.mdb;"; OleDbConnection dbConn = new OleDbConnection(connStr);string sqlStr = "SELECT [user_id], [username], [password_test], [avatar], [date_added],, [real_name] " +"[location], [website], [occupation], [interests], [forum_posts] FROM members WHERE user_id = '" + id + "'";
dbConn.Open();
OleDbCommand dbCommand = new OleDbCommand(sqlStr, dbConn);OleDbDataReader dbReader = dbCommand.ExecuteReader();while (dbReader.Read()){
user.user_id = dbReader[
"user_id"].ToString();user.username = dbReader["username"].ToString();user.email = dbReader[
"email"].ToString();user.avatar = dbReader["avatar"].ToString();user.date_added = dbReader[
"date_added"].ToString();user.real_name = dbReader["real_name"].ToString();user.location = dbReader[
"location"].ToString();user.website = dbReader["website"].ToString();user.occupation = dbReader[
"occupation"].ToString();user.interests = dbReader["interests"].ToString();user.forum_posts = dbReader["forum_posts"].ToString();}
dbReader.Close();
return user;}
the website i am creating is a forum. Here users can click on other users names and view their profile.. What i need to do is consume this web service so that i can do this.. but i dont know how exactly to do it?
I did try with the following code..
localhost.Service myws = new localhost.Service();localhost.
Person member = new localhost.Person();member.user_id = Request.QueryString["ID"];Label1.Text = member.username;
Label2.Text = member.date_added;
But it does not work, the querystring holds the user_id of the user so i thought from this it would be easy to pull out everything else..
Any help would be much appreciated.
Thanks
Regards
![]() |
0 |
![]() |
It looks like you need to call the web service:
Person member = myws.User_Details(userid);
Steve Wellens
My blog
![]() |
0 |
![]() |