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.


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();
}
}
}
The fastest approach is to extend the autogenerated
TableAdapterin yourDataSetwith a method that returns your ID’s asList<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:
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
DataTablebut aList<int>with your product_ids.After you’ve extended the
TableAdapterin the abovementioned way: