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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:35:26+00:00 2026-05-30T06:35:26+00:00

I have got problem with this method: public List<int> menu_wid_w_kat() { DataSet1TableAdapters.menu_widac_wszystkoTableAdapter pk =

  • 0

I have got problem with this method:

    public List<int> menu_wid_w_kat()
    {
        DataSet1TableAdapters.menu_widac_wszystkoTableAdapter pk = new DataSet1TableAdapters.menu_widac_wszystkoTableAdapter();
        List<int> lista = new List<int>();
        lista = pk.?
        return lista;
    }

In dataset1 I have got Fill, GetData (@id) and this is connected with procedure (procedure working correct)

Problem is in this method because I don’t know how connect this method with dataset1 (but I don’t want to using linq: (lista = (from o in pk.GetData() select o.nazwa).ToList();))

my idea was but does not work but probably you will understand what I want to do it. Connection with method put (id number) and get data list:

lista = pk.GetData(id)

I just want to take data from this procedure which exist in dataset1.

enter image description here
enter image description here

correct but I can`t find method GetIdList()

baza nasza_baza = new baza();
var da = new DataSet1TableAdapters.menu_widac_wszystkoTableAdapter();
List productIDs = da. <- I cant`t find method

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DataSet1TableAdapters 
{
    public partial class menu_widac_wszystkoTableAdapter
    {
        public List<int> GetIdList(int ids)
        {
            List<int> list = new List<int>();
            System.Data.SqlClient.SqlCommand command = this.CommandCollection(ids);
            command.CommandTimeout = command.Connection.ConnectionTimeout;

            System.Data.ConnectionState previousConnectionState = command.Connection.State;
            try
            {
                if (((command.Connection.State & System.Data.ConnectionState.Open) != System.Data.ConnectionState.Open))
                {
                    command.Connection.Open();
                }
                using (System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        list.Add(reader.GetInt32(0));
                    }
                }
            }
            finally
            {
                if ((previousConnectionState == System.Data.ConnectionState.Closed))
                {
                    command.Connection.Close();
                }
            }

            return list;
        }

        private System.Data.SqlClient.SqlCommand CommandCollection(int p)
        {
            throw new NotImplementedException();
        } 

    }
}
  • 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-30T06:35:28+00:00Added an answer on May 30, 2026 at 6:35 am

    The fastest approach is to extend the autogenerated TableAdapter in your DataSet with a method that returns your ID’s as List<int>.

    If you want to extend the functionality you can’t change the generated classes in the DatesetName.designer.cs/vb (it will be recreated on any change) but the file without designer in its name(create it if it not exists). Then you have to extend the partial TableAdapter-class(in your case menu_widac_wszystkoTableAdapter).

    Have a look at following code to see what i mean, i haven’t tested it but i hope you take my point:

    namespace YourRootNameSpace.DataSet1TableAdapters {
    {
        public partial class menu_widac_wszystkoTableAdapter
        {
            public List<int> GetIdList(int categoryID)
            {
                List<int> list = new List<int>();
                System.Data.SqlClient.SqlCommand command = this.CommandCollection[0];
                command.CommandTimeout = command.Connection.ConnectionTimeout;
    
                System.Data.ConnectionState previousConnectionState = command.Connection.State;
                try {
                    if (((command.Connection.State & System.Data.ConnectionState.Open) != System.Data.ConnectionState.Open)) {
                        command.Connection.Open();
                    }
                    command.Parameters[ "@id" ].Value = categoryID;
                    using (System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader()) {
                        while (reader.Read()) {
                            list.Add(reader.GetInt32(0));
                        }
                    }
                } finally {
                    if ((previousConnectionState == System.Data.ConnectionState.Closed)) {
                        command.Connection.Close();
                    }
                }
    
                return list;
            }
        }
    }
    

    Edit: After i’ve read your edited question i saw that i’ve misunderstood your requirement a little bit, but my approach should be perfect anyway. Basically you don’t want to get a DataTable but a List<int> with your product_ids.

    After you’ve extended the TableAdapter in the abovementioned way:

    var da = new DataSet1TableAdapters.menu_widac_wszystkoTableAdapter();
    List<int> productIDs = da.GetIdList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I've got problem with foreach statement. I have my controller method: public ActionResult
I've got a Tile class with this method: public object Clone() { return MemberwiseClone();
The responses I've got to this question have solved the problem I had in
I have got a problem with submitting data to Post method. I have a
I have a class like this: public class myClass { public List<myOtherClass> anewlist =
I have got a List<Problem> which I want to export to a column based
I got this problem. I have a form that retrieves a table data using
I have got a problem with calling a global function, which takes a pointer
I have got the following problem since the server has safe mode turned on,
I have got a strange problem about in_array recently which I cannot understand. e.g.

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.