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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:11:49+00:00 2026-05-20T10:11:49+00:00

So I am porting a legacy application over from coldfusion to asp.net/c#. My problem

  • 0

So I am porting a legacy application over from coldfusion to asp.net/c#. My problem is, (and I have searched all over for it, but I may not be wording my problem properly to get good results), is that I want to take my results from a the first query I have, and perform a second query to fill in that column.

Here’s how I did it in coldfusion:

<cfquery name="p" datasource="db">
   select * from table
</cfquery>

<cfloop query="p">
   <tr>
      <td>
         <a href="page.cfm?id=#p.id#">#p.title#</a>
      </td>
      <td">
         #p.category#
      </td>
      <td>
         #CreateObject("component","/components.dao").getuser(p.userid).user_fullname()#
      </td>
   </tr>
</cfloop>

You’ll notice I call a component and method that I send the userid from the query too. This method has another query that calls a seperate database, and returns information on that user, in this case the full name rather than just the userid. This is where I am having problems in asp.net/c# for that I have created the following code:

<asp:Repeater id="program_list" runat="server">
   <ItemTemplate>
      <tr>
         <td>
            <a href="page.aspx?id=<%# Eval("id") %>"><%# Eval("title") %></a>
         </td>
         <td>
            <%# Eval("category") %>
         </td>
         <td>
            <%# Eval("userid")%> (needs full name convert)
         </td>
      </tr>
   </ItemTemplate>
</asp:Repeater>

and in the codebehind

protected void Page_Load(object sender, EventArgs e)
{
   try
   {
      DbConnection connection = new SqlConnection();
      connection.ConnectionString = "***";
      connection.Open();

      SqlCommand cmd = (SqlCommand)connection.CreateCommand();
      cmd.CommandType = CommandType.Text;
      cmd.CommandText = "SELECT * FROM table";

      SqlDataReader reader = null;
      reader = cmd.ExecuteReader();
      program_list.DataSource = reader;
      program_list.DataBind();
      reader.Close();
      connection.Close();
   }
   catch (Exception ex)
   {
      Response.Write(ex);
   }
}

As you can see, it only does the first part, outputting the original query, but I am not sure how to interact with that query in order to call the database the second time for the users details. Any ideas would be greatly appreciated, thanks.

  • 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-20T10:11:50+00:00Added an answer on May 20, 2026 at 10:11 am

    so you need to call an sql query each line of repeater. you should use ItemDataBoundEvent , in this event you can have processing rows user_id and can make another query.

    for example

    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            DataRowView drw = (DataRowView)e.Item.DataItem
            String sql = String.Format("Select * FROM UserInfo WHERE user_id={0}", drw["user_id"]);
    
    
            Label lblUserName = (Label) e.Item.FindControl("lblUserName");
            lblUserName.Text = //WWhatever you get from query...
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are in the process of porting a legacy system to .NET, both to
While porting an application from SQL 2005 to SQL Server Compact Edition, I found
I am planning on porting a PHP application over to Python. The application is
While porting a desktop application to windows mobile I've reached the following error: Error
Im porting a project from php to java. The project is a web-app based
I'm working on porting a Visual C++ application to GCC (should build on MingW
I am porting a game, that was originally written for the Win32 API, to
I'm porting old VB6 code that uses the Winsock control to C#. I haven't
I'm porting a Java library to C#. I'm using Visual Studio 2008, so I
I'm porting some MATLAB functions to Scilab . The cool thing is that there

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.