Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6136757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:38:30+00:00 2026-05-23T17:38:30+00:00

I’m posting the upper portion of code. No matter what I do the compiler

  • 0

I’m posting the upper portion of code. No matter what I do the compiler says I’m missing a name space or I’m using a method like a class or its expecting ‘or =’. I’m totally new to C# programming.

The problem: Query checks if people are in your network. People with others in network, no error. People without others in their network, error. (I didnt even get to looping through the network query to populate the ‘friends’ section in the XML portion if friends are in their network)

Thanks is advance for the help

<%@ Page language="c#" %>

<script runat="server" language="C#">
        protected void Page_Load(object sender, EventArgs e)
        {
            string xml;
            try
            {
                xml = Auth(Request.Params["uid"].ToString());
            }
            catch (Exception ex)
            {
                xml = ex.Message;
            }
            if (!string.IsNullOrEmpty(xml))
            {
                Response.Clear();
                Response.ExpiresAbsolute = DateTime.Now;
                Response.AddHeader("Content-type", "text/xml");
                Response.Write(xml);
            }
            if (!string.IsNullOrEmpty(xml) || Request.Params["uid"] != string.Empty)
            {
                Response.End();
            }
        }



        protected virtual string Auth(string uid)
        {
            String xml;

            if (!String.IsNullOrEmpty(Request["uid"]))
            {

                System.Data.DataTable dtTable = new System.Data.DataTable();
                System.Data.DataTable memTable = new System.Data.DataTable();
                System.Data.DataTable netTable = new System.Data.DataTable();
                System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString);
                conn.Open();

                string query = "SELECT userid, username, city, state, country, birthday, img1, userLevelName, gendername, title FROM UserInfo INNER JOIN Gend ON UserInfo.gendID = Gend.gendID INNER JOIN UserLevel ON UserInfo.UserLevelID = UserLevel.UserLevelID WHERE userid='" + Request["uid"] + "'";
                System.Data.SqlClient.SqlDataAdapter adp = new System.Data.SqlClient.SqlDataAdapter(query, conn);
                adp.Fill(dtTable);

                //start of problem is that the next query checks to see if someone is in your network, people with others in network, no error. people without others in their network error

                string query1 = "SELECT MemID FROM network WHERE userid='" + Request["uid"] + "'";
                System.Data.SqlClient.SqlDataAdapter memdp = new System.Data.SqlClient.SqlDataAdapter(query1, conn);
                memdp.Fill(memTable);

                string query2 = "SELECT Distinct userid, username, img1, birthday, gendid, city, state, country, title FROM UserInfo WHERE (userinfo.userid IN (" + memTable.Rows[0]["memid"] + ")) AND userinfo.img1 is not null order by userinfo.username";
                System.Data.SqlClient.SqlDataAdapter netdp = new System.Data.SqlClient.SqlDataAdapter(query2, conn);
                netdp.Fill(netTable);

                //end of problem

                conn.Close();

                xml = string.Format("<login result=\"OK\">" +
                    "<userData>" +
                        "<id><![CDATA[" + dtTable.Rows[0]["userid"] + "]]></id>" +
                        "<name><![CDATA[" + dtTable.Rows[0]["username"] + "]]></name>" +
                        "<gender><![CDATA[" + dtTable.Rows[0]["gendername"] + "]]></gender>" +
                        "<location><![CDATA[" + dtTable.Rows[0]["city"] + "]]>, <![CDATA[" + dtTable.Rows[0]["state"] + "]]>, <![CDATA[" + dtTable.Rows[0]["country"] + "]]></location>" +
                        "<age>22</age>" +
                        "<photo>http://www.somesite.com/thumbnail.asp?path=" + dtTable.Rows[0]["img1"] + "</photo>" +
                        "<thumbnail>http://www.somesite.com/thumbnail.asp?path=" + dtTable.Rows[0]["img1"] + "</thumbnail>" +
                        "<details><![CDATA[" + dtTable.Rows[0]["title"] + "]]></details>" +
                        "<level><![CDATA[" + dtTable.Rows[0]["userlevelname"] + "]]></level>" +
                        "<profileUrl>http://www.somesite.com/" + dtTable.Rows[0]["username"] + "</profileUrl>" +
                    "</userData>" +

                    "<friends>" +
                        "<friend>" +
                            "<id>2</id>" +
                            "<name>Bill</name>" +
                            "<gender>0</gender>" +
                            "<location>London, UK</location>" +
                            "<age>22</age>" +
                            "<photo>http://yourdomain/photos/bill.png</photo>" +
                            "<thumbnail>http://yourdomain/photos/bill_small.png</thumbnail>" +
                            "<details>Hello, I am Bill</details>" +
                            "<level>regular</level>" +
                        "</friend>" +
                    "</friends>" +
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:38:31+00:00Added an answer on May 23, 2026 at 5:38 pm

    Try this.

    protected string Auth(string uid)
    {
        string xml = String.Empty;
    
        if (!String.IsNullOrEmpty(Request["uid"]))
        {
            string query1 = "SELECT userid, username, city, state, country, birthday, img1, userLevelName, gendername, title FROM UserInfo INNER JOIN Gend ON UserInfo.gendID = Gend.gendID INNER JOIN UserLevel ON UserInfo.UserLevelID = UserLevel.UserLevelID WHERE userid='" + Request["uid"] + "'";
            System.Data.DataTable dtTable = FillDataTableFromDB(query1);
            string query2 = "SELECT MemID FROM network WHERE userid='" + Request["uid"] + "'";
            System.Data.DataTable memTable = FillDataTableFromDB(query2);            
            xml = "<login result=\"OK\">" +
                "<userData>" +
                    "<id><![CDATA[" + dtTable.Rows[0]["userid"] + "]]></id>" +
                    "<name><![CDATA[" + dtTable.Rows[0]["username"] + "]]></name>" +
                    "<gender><![CDATA[" + dtTable.Rows[0]["gendername"] + "]]></gender>" +
                    "<location><![CDATA[" + dtTable.Rows[0]["city"] + "]]>, <![CDATA[" + dtTable.Rows[0]["state"] + "]]>, <![CDATA[" + dtTable.Rows[0]["country"] + "]]></location>" +
                    "<age>22</age>" +
                    "<photo>http://www.somesite.com/thumbnail.asp?path=" + dtTable.Rows[0]["img1"] + "</photo>" +
                    "<thumbnail>http://www.somesite.com/thumbnail.asp?path=" + dtTable.Rows[0]["img1"] + "</thumbnail>" +
                    "<details><![CDATA[" + dtTable.Rows[0]["title"] + "]]></details>" +
                    "<level><![CDATA[" + dtTable.Rows[0]["userlevelname"] + "]]></level>" +
                    "<profileUrl>http://www.somesite.com/" + dtTable.Rows[0]["username"] + "</profileUrl>" +
                "</userData>";
            if(memTable != null && memTable.Rows.Count >0)
            {
    
                string query3 = "SELECT Distinct userid, username, img1, birthday, gendid, city, state, country, title FROM UserInfo WHERE (userinfo.userid IN (" + memTable.Rows[0]["memid"] + ")) AND userinfo.img1 is not null order by userinfo.username";
                System.Data.DataTable netTable = FillDataTableFromDB(query3);
                if(netTable != null && netTable.Rows.Count >0)
                {
                    xml = "<friends>";
    
                    foreach(System.Data.DataRow row in netTable.Rows)
                    {
                        xml = "<friend>" +
                            "<id><![CDATA[" + row["userid"] + "]]></id>" +
                            "<name>Bill</name>" +
                            "<gender>0</gender>" +
                            "<location>London, UK</location>" +
                            "<age>22</age>" +
                            "<photo>http://yourdomain/photos/bill.png</photo>" +
                            "<thumbnail>http://yourdomain/photos/bill_small.png</thumbnail>" +
                            "<details>Hello, I am Bill</details>" +
                            "<level>regular</level>" +
                            "</friend>";
                    }
                    xml = "</friends>";
                }
            }
        }
        return xml;
    }
    
    private System.Data.DataTable FillDataTableFromDB(string query)
    {
        System.Data.DataTable datatable = new System.Data.DataTable(); 
        string connString = System.Configuration.ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString;
        using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString))
        {
            using (System.Data.SqlClient.SqlDataAdapter adapter = new System.Data.SqlClient.SqlDataAdapter(query, conn))
            {
                adapter.Fill(datatable);
            }
        }
        return datatable;
    }
    

    P.S: Please do not code like what is given in your snippet. Functions are there for a reason. Also there is something called StringBuilder. Whats the point on using virtual on aspx? This code just solves the errors. I am sad that you are not making a serious attempt at coding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I would like to count the length of a string with PHP. The string
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.