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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:31:42+00:00 2026-06-16T05:31:42+00:00

I made my own SQL string that uses INNER JOINS. Here is my function:

  • 0

I made my own SQL string that uses INNER JOINS. Here is my function:

string cmdstr = @"SELECT s.*, mdb.menu_name
                  FROM stocksdb s, recipelist rl
                  INNER JOIN menudb mdb  ON rl.menu_ID = mdb.menu_ID
                  WHERE rl.stock_ID = '" + stockID + "'";

var cmd = new MySqlCommand(cmdstr, db.mycon);
var dr = cmd.ExecuteReader();
while (dr.Read())
{
    var menuname = dr["menu_name"].ToString();

    stockIDTxtbox.Text = stockID;
    nameTxtBox.Text = dr["stock_name"].ToString();
    availableTxtbox.Text = dr["stock_quantity"].ToString();
    pricePerPieceTxtbox.Text = dr["stock_pricePerPiece"].ToString();
    limitTxtBox.Text = dr["stock_limit"].ToString());

    recipeList.Items.Add(new ListViewItem(new[] { menuname });
}

Now the problem is, when I click one Item on the stocksList ListView the recipeList ListView would have multiple values. Like 5 or so rows of the same values.

  • 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-16T05:31:43+00:00Added an answer on June 16, 2026 at 5:31 am

    A join with stocksdb is missing. Something like this:

       SELECT s.*, mdb.menu_name 
       FROM stocksdb s
    
       INNRER JOIN recipelist rl 
       ON s.stock_ID= r1.stock_ID   <== this join was missing
    
       INNER JOIN menudb mdb 
       ON rl.menu_ID = mdb.menu_ID 
       WHERE rl.stock_ID = '" + stockID 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made my own exception class which derives from runtime_error and is getting
I have created a function that updates some values from a database that I
My product uses a SQL Server database - each client has their own deployed
I am currently in the middle of creating an app that uses a sql
I have made my own map using the google maps api. It is a
I recently made my own Javascript library and I initially used the following pattern:
I have made my own file type (.ddd) and I made a simple program
I've made my own tree data structure via classes. Now I'm stuck with really
I have made my own sms app with a reciver. Now the emulator doesn'T
I am setting up a own made wysiwyg plugin for jQuery. He is almost

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.