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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:31:13+00:00 2026-06-07T17:31:13+00:00

I have create a stored procedure with name getCusnmae1 set ANSI_NULLS ON set QUOTED_IDENTIFIER

  • 0

I have create a stored procedure with name getCusnmae1

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [dbo].[getCusnmae1]
AS
BEGIN
    SELECT ALL * FROM dbo.Customers;
    SELECT ALL * FROM dbo.Order1;
END

now what i have done so far that create a property class Customer and want to display data on the grid

I wrote the code for this is:

conn1.ConnectionString = " server=.\\ms2k5;database=Inventory;Trusted_Connection=true";
            conn1.Open();
            SqlCommand testCMD = new SqlCommand ("getCusnmae1", conn1);
            testCMD.CommandType = CommandType.StoredProcedure;
            SqlDataReader myReader = testCMD.ExecuteReader();
            List<Customer> list = new List<Customer>();
            while (myReader.Read())
            { 
                Customer md = new Customer();
                md.CustName = myReader.;
                md.custname = myReader.GetValue(1).ToString();
                md.contact = myReader.GetValue(2).ToString();
                list.Add(md);
            } 

by which I get column value only from the Customers Table
what i Have to do to get data from child table Order1

When I write

 md.contact = myReader.GetValue(3).ToString();

to acess order table it does not work..

please help
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-06-07T17:31:15+00:00Added an answer on June 7, 2026 at 5:31 pm

    Use SqlDataReader.NextResult() method to handle multiple Results.

    SqlDataReader myReader = testCMD.ExecuteReader();
    while (myReader.Read())
     { 
      //
     } 
    myReader.NextResult();
    while (myReader.Read())
     { 
      //
     } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this MS SQL Stored Procedure: ALTER PROCEDURE [dbo].[Import_Agent_Client_Bucket_2010] AS BEGIN --
I have following stored procedure: CREATE PROCEDURE testProc(IN p_idProject INTEGER) BEGIN DECLARE nowTime DATETIME;
I have created a stored procedure CREATE PROCEDURE GetCustomerWiseSales(@StartDate nvarchar(10), @EndDate nvarchar(10)) AS SELECT
I have a SQL Server Stored Procedure that looks like this: CREATE PROCEDURE [dbo].[my_stored_procedure]
I have a stored procedure called usp_getTotalOrder which looks like Select * from Order
Using SQL Server 2008, I have two stored procedures - create procedure [dbo].[SH_Export_data] (@unit
I have a stored procedure :- CREATE procedure St_Proc_GetTimeEntryID @userID int, @timeEntryID int output
I have this stored procedure: CREATE OR REPLACE PROCEDURE LIQUIDACION_OBTENER ( p_Cuenta IN NUMBER,
I have the fallowing stored procedure: CREATE PROCEDURE `get`(IN tb VARCHAR(50), IN id INTEGER)
I am using Oracle 10g and I have the following stored procedure: CREATE OR

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.