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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:29:44+00:00 2026-06-17T12:29:44+00:00

I have a method for adding values to the database for all operations. If

  • 0

I have a method for adding values to the database for all operations.

If this is selected from the database and this select return more rows from the database,
how can I get the rows and store in an array?

This is the method code :

public void ExcuteProcedure(string procName, List<SqlParameter> procparams)
{
            try
            {
                SqlConnection mycon = new SqlConnection(connectionString);
                mycon.Open();
                SqlCommand mycom = new SqlCommand();
                mycom.Connection = mycon;
                mycom.CommandText = procName;
                mycom.CommandType = CommandType.StoredProcedure;
                foreach (var item in procparams)
                {
                    SqlParameter myparm = new SqlParameter();
                    myparm.ParameterName = item.ParameterName;
                  //  myparm.SqlDbType = item.SqlDbType;
                    myparm.Value = item.Value;
                    mycom.Parameters.Add(myparm);
                }
              var n= mycom.ExecuteScalar();

                mycon.Close();
            }
            catch (SqlException e)
            {
                Console.WriteLine("Error Number is : " + e.Number);
                Console.WriteLine("Error Message is : " + e.Message);
            }
}
  • 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-17T12:29:45+00:00Added an answer on June 17, 2026 at 12:29 pm

    You need to call mycom.ExecuteReader(), which will give you a SqlDataReader which can read through the results.

    Call Read() to advance through the rows.

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

Sidebar

Related Questions

I have a method that is adding custom objects to an array in a
I have a method called setSound() which is setting up a queue and adding
I have a customizedBinding where iam adding various bindings in the CreateBindingElemens method. Everything
I have an Ajax-enabled CRUD application. If I display a record from my database
I have a form that allows uploads of images. The user can select which
I use a form where i have listed the data from database like title,
Let´s say I a have an User class and I want to return all
I have got this code: $title = mysql_real_escape_string($_POST['title']); $description = mysql_real_escape_string($_POST['description']); $method = mysql_real_escape_string($_POST['method']);
I have some data being pulled in from an Entity model. This contains attributes
I'm currently working on adding, viewing and removing values in an android database but

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.