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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:01:05+00:00 2026-06-06T20:01:05+00:00

It is a windows application. Originally I have a dataset for a dropdown menu

  • 0

It is a windows application.
Originally I have a dataset for a dropdown menu from a table. Now I want to use a stored procedure. How to modify the process in the code?

I think that maybe the best way is to delete the the dataset and recreate a new dataset. But can we do in the designer code?

Thanks.

EDIT

  protected Problem_DE_DataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : 
            base(info, context, false) {
        if ((this.IsBinarySerialized(info, context) == true)) {
            this.InitVars(false);
            global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler1;
            this.Relations.CollectionChanged += schemaChangedHandler1;
            return;
        }
        string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
        if ((this.DetermineSchemaSerializationMode(info, context) == global::System.Data.SchemaSerializationMode.IncludeSchema)) {
            global::System.Data.DataSet ds = new global::System.Data.DataSet();
            ds.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema)));
            if ((ds.Tables["Problem_DE"] != null)) {
                base.Tables.Add(new Problem_DEDataTable(ds.Tables["Problem_DE"]));
            }
            this.DataSetName = ds.DataSetName;
            this.Prefix = ds.Prefix;
            this.Namespace = ds.Namespace;
            this.Locale = ds.Locale;
            this.CaseSensitive = ds.CaseSensitive;
            this.EnforceConstraints = ds.EnforceConstraints;
            this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add);
            this.InitVars();
        }
        else {
            this.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema)));
        }
        this.GetSerializationData(info, context);
        global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
        base.Tables.CollectionChanged += schemaChangedHandler;
        this.Relations.CollectionChanged += schemaChangedHandler;
    }
  • 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-06T20:01:06+00:00Added an answer on June 6, 2026 at 8:01 pm

    Well the code is easy. Implying your SQLCommand is called myCommand

    • Change the myCommand.Text to the name of the stored procedure.

    • Change the myCommand.CommandType to CommandType.StoredProcedure.

    For each parameters you have in you stored procedure use this line :

    • myCommand.Parameters.AddWithCalue("@YourSQLParameter",YourValue)

    I like using DataReaders for this type of operation.

    • SQLDataReader myReader = myCommand.ExecuteReader();

    Voila ! You’re StoredProcedure is executed.

    Now let’s say you want to add the results of the sotred procedure to the ComboBox.

    • while (myReader.Read())
      {
      myComboBox.Items.Add(myReader["ColumnName"].Tostring();
      }

    Basic example but i’m sure you get the point. If you need more info you can always read this tutorial it pretty much explain what you want.

    Update :

    It got messy with the generated code you posted up there but the approach is still the same. From what I understand you only want to read from a table using a Stored Procedure and fill a ComboBox or DropDownList with a certain field. You should try and type it from scratch in the code section without using this designer to understand how it works.

    You should have something like this :

            //Creates a connection to your DataBase
            SqlConnection myConnection = new SqlConnection(@"Server=YOURSERVER;Database=YOURDATABASE;User id=YOURID; Password=YOURPASSWORD");
            //Opens the connection
            myConnection.Open();
            //Creates a command (Query)
            SqlCommand myCommand = myConnection.CreateCommand();
            //Sets the type of query to Stored Procedure (EXEC ...)
            myCommand.CommandType = CommandType.StoredProcedure;
            //The Query is set to stored procedure so (EXEC THE_NAME_OF_YOU_STOREDPROCEDURE)
            myCommand.CommandText = "THE_NAME_OF_YOUR_STOREDPROCEDURE";
    
            //This will add each parameter to your query (EXEC THE_NAME_OF_YOURSTOREDPROCEDURE @YOURPARAMETER
            myCommand.Parameters.AddWithValue("@YOURPARAMETER", THE_VALUE_OF_THE_PARAMETER);
            SqlDataReader myReader = myCommand.ExecuteReader();
    
            //For each records returned the item from the ["YOURCOLUMN"] will be added to the comboBox
            while(myReader.Read())
            {
              myComboBox.Items.Add(myReader["YOUR_COLUMN_NAME"]);
            }
            myReader.Close();
            myConnection.Close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created Windows Application. In this, I have multiple tables in dataset, now
I have one .net windows application I'm trying to read .xml file from c#
I have a form in a Windows form application that I want to display
I have a Windows Forms application, and I use an instance of Windows Media
I want to have a referenced dll in my Windows Forms Application project. It
win32 windows application and want to capture full screen and remove the border of
I have a windows application written in VB.net. After finishing it I'll setup the
I am working in Windows Application. I am reading a value from Excel and
I have developed a windows application with vs2010 and c#. I would like to
I'm working on a multi-user phonebank software. I originally was planning to use Windows

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.