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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:26:23+00:00 2026-05-21T03:26:23+00:00

Something stopped working in my application. I tested my stored procedure and it does

  • 0

Something stopped working in my application. I tested my stored procedure and it does return 3 rows (too big to repost here). At the output in Visual Studio it says afterwards:

(1 row(s) affected)
(3 row(s) returned)
@RETURN_VALUE = 0
Finished running [dbo].[GetCaseDocumentFile].

Why can’t I put it into the datatable called dtResult? The command sqlDataAdapter.Fill(dtResult) should do it. Instead I get {} when looking at it in debug mode.

string connectionString = @"Data Source=34.56.55.251;Initial Catalog=DBXXX;User ID=xx;Password=XXXXXXXX;";
string queryString = "GetCaseDocumentFile";

using (SqlConnection connection = new SqlConnection(connectionString))
            {
    SqlCommand command = new SqlCommand(queryString, connection);
    command.CommandType = System.Data.CommandType.StoredProcedure;
    command.Parameters.AddWithValue("@key", 200012);

    connection.Open();

    // Works! Three lines are returned.
    SqlDataReader reader = command.ExecuteReader();
    try
    {
        while (reader.Read())
        {
            Console.WriteLine(String.Format("{0}, {1}",
                reader[0], reader[1]));
        }
    }
    finally
    {
        reader.Close();
    }

    // Does not work! dtResult remains empty. {}
    DataTable dtResult = new DataTable();
    SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(command);
    sqlDataAdapter.Fill(dtResult);

    DataTable result = dtResult;
}

Update:

Nevermind. This actually works. This is my test code and what I thought my real code does. But I guess that I overlooked something in the real code.

  • 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-21T03:26:24+00:00Added an answer on May 21, 2026 at 3:26 am

    Have You set no count on in your Procedure??
    Set NoCount On;

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

Sidebar

Related Questions

I'm trying to resolve the following problem: [.Net 2.0, CLR 2.5.something, 64 bit machine,
I have some threads fishing into a queue for jobs, something like this: class
We've recently upgraded Rails to 2.3.8 (from something so ancient you don't wanna know).
Update: if you've added symbolic breakpoints and they're not working, uh, wait awhile. After
I am updating a div with a partial view by using something like this:
I have a php script that I have used for years to force downloads
I have been using the following code for months (without problem) in a .NET
(Disclaimer: I have removed the Qt tag in case the problem is in my
I have a table cell with a RadioButtonList . When each item is selected,
If I upgrade a WCF Web Service from .NET 3.5 to 4.0, making no

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.