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 7799663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:23:08+00:00 2026-06-02T00:23:08+00:00

I recently asked a questtion on how o write a query and thankfully you

  • 0

I recently asked a questtion on how o write a query and thankfully you guys answered me (Thank you)

My Last Question

Im working on a WML site so I need to pass the values from the query
I found a way to do so (shown below in code) , but It didnt work.

    <%   
//this Query was provided earlier in the previous question.

        string queryString = "select st.firstname + ' ' + st.lastname,se.year, c.coursename,c.NumberOfCredits,ri.mark  from Students st inner join RegisteredIn ri on ri.StudentId=st.id inner join Semester se on se.id=ri.SemesterId inner join Courses c on c.id=se.id ";

the Way I found but didnt work

         using (System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(connectionString))
         {

            System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(queryString, connection);

            command.Parameters.AddWithValue("@StudentId",StudentId);

                connection.Open();
                System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader();
                if (reader.HasRows)
                {
                    reader.Read();
                    string _firstname = reader[0].ToString();
                    string _lastname = reader[1].ToString();
                    string _coursename = reader[2].ToString();
                    string _credits = reader[3].ToString();
                    string _mark = reader[4].ToString();

                    string url = string.Format("~/StudentInfo.aspx?StudentId={0}&firstname={1}&lastname={2}&coursename={3}&credits={4}&mark={5}", StudentId, _firstname, _lastname, _coursename, _credits, _mark);
                    Response.Redirect(url);

    %>

The page reciving the paramaters will be somthing like

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="StudentInfo.aspx.cs" Inherits="StudentInfo" %>

<wml>
    <card>



        <p><% Response.Write(Request.Params["StudentId"]);%></p>
        <p><b>firstname:</b> <% Response.Write(Request.Params["firstname"]);%></p>
        <p><b>lastname:</b> <% Response.Write(Request.Params["lastname"]);%></p>
        <p><b>coursename:</b> <% Response.Write(Request.Params["coursename"]);%></p>
       <p><b>credits:</b> <% Response.Write(Request.Params["credits"]);%></p>
        <p><b>Mark:</b> <% Response.Write(Request.Params["mark"]);%></p>

    </card>
</wml>

the result will be somthing like

First Semester  2010
Student : Arin Rizk

Course Name     No. of Credit      Mark
    AAA                3            65
    BBB                3            23
    CCC                3            65
    DDD                3            58
    EEE                3            70

Your GPA for this semster is 3.12

My Questions are:
– How to extract the values from the query and into the URL ?
– How I will display multiple values in WML or in ASP ? (as the results will be multiple lines and of values)

Thank you in advance

  • 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-06-02T00:23:10+00:00Added an answer on June 2, 2026 at 12:23 am

    Your code as it is now will read only first row from database. To read all rows, you must call Reader.Read() in a loop, something like:

    while(reader.Read())
    {
        string _firstname = reader[0].ToString();
        string _lastname = reader[1].ToString()
        ...
    }
    

    But I’m afraid that passing all this information as parameter in URL really is not good idea. You would have to join somehow results from all rows and on the other page split them back to individual values, which seems to me superfluous. Moreover, URL length is usually limited so if your query returns more than just a few rows, it will not work. Why do you want to transfer whole query result in URL? It’s more common (and much easier to do) to transfer in URL just identifier of student (or whatever you want to show) and on the second page read data again from database.

    UPDATE:
    If I understand you correctly, your actual question is not how to pass result of database query in querystring to another page, but you want to display result of your query on page. First step is to add appropriate control (Label, DataGridView, etc.) on the form of second page. Then depending on what control you have used you can either bind control to data source, or add data to control manually in method such as Page_Load in StudentInfo.aspx file. But since this is completely different topic than what you were asking first, I suggest you to ask another question. Also this topic was dicsussed here many times, so you may take a look on these questions first.

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

Sidebar

Related Questions

I recently asked a question relating to the javascript not working on my site
I recently asked a question on dynamically forming YouTube iframe src which was answered
This is an interview Question that i was asked recently: Write a C program
Recently in an interview i was asked a question to write a function which
I recently asked a question about using XSL/t for creating a site layout and
I recently asked a question about structs, and optimizing some overloaded operators. The original
I recently asked a question about formatting JavaScript code in Vim. And I've also
I recently asked the question Is the behavior of return x++; defined? The result
I recently asked this question: MS SQL share identity seed amongst tables (Many people
I've recently asked a question about clipping an image via path at view's drawRect

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.