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

  • Home
  • SEARCH
  • 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 6337889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:20:18+00:00 2026-05-24T19:20:18+00:00

I am creating a web form on asp.net that will allow the end user

  • 0

I am creating a web form on asp.net that will allow the end user to assign multiple users bassed on a selected department to a quiz..

the database is mysql database since I use joomla

the tables on mysql are:

jos_users_quizzes with the following columns:
id
quiz_id
user_id

I have a second is called called  jos_users with this columns

id
name
username
department

the user_id on first table is going to be euqal to the id of second table jos_users

so quiz_id = id (jos_users)

How can build a query to multiple insert the ids of a selected department into the jos_users_quizzes table… IN ONE CLICK, I have a dropdownlist for the quiz ids and one for the userids , departments

I need to select all user ids from selected department and insert those id into the user_quizzes table.

Code from and ASP.NET form to insert ….

 private void InsertRecords(StringCollection sc)
    {
        string ConnectionString = @"driver={MySQL ODBC 5.1 Driver};server=localhost;database=db_dhruniversity;uid=root;pwd=;";
        OdbcConnection conn = new OdbcConnection(ConnectionString);

        try
        {

            conn.Open();


            string quizidselected = DropDownList1.SelectedValue;
            string deptselected = ListBox2.SelectedValue;
           // OdbcCommand cmd = new OdbcCommand("INSERT INTO jos_jquarks_users_quizzes (user_id, quiz_id)    SELECT uid, ' " + quizidselected + " ' FROM dhruprofile  WHERE department = ' " + deptselected + " '");             
            cmd.Connection = conn;
            cmd.CommandType = CommandType.Text;

            cmd.ExecuteNonQuery();
            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Script", "alert('Records Successfuly Saved!');", true);

        }

        catch (System.Data.SqlClient.SqlException ex)
        {

            string msg = "Insert Error:";
            msg += ex.Message;
            throw new Exception(msg);

        }

        finally
        {

            conn.Close();

        }

    }
  • 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-24T19:20:18+00:00Added an answer on May 24, 2026 at 7:20 pm

    Try to run:

    Insert into jos_users_quizzes(quiz_id, user_id) select (your_quiz_id, user_id) from   jos_users where department='selectd_depatment'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a multi-part web form in ASP.NET that uses Panels for the different
I'm creating a web service that'll be called from a web form in asp.net.
Greetings! I'm creating a web form prototype (ImageLaoder.aspx) that will return an image so
I am creating a web service for end users which will have a front-end
I'm creating a web form that requires an user to upload a file in
This requires a bit of background. I'm creating a web app (ASP.NET/VB.NET with SQL
I am creating a very simple web part that accepts entry on a form
I'm writing a simple web form for a client in ASP.NET. The form sends
Hi I am currently developing a web app in ASP.net. I am creating a
I have a bit of experience in creating web applications using asp.net however I

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.