1
Answer

IorderdQuaryable

bahare g

bahare g

14y
1.7k
1

hello my firends
i write a select method named slc in myclass. slc method return  result from  select of contact table. this method result is IorderdQueryable  and i call this in my code-behind and i assign this result to a ListBox, i want to know how can i close my connection in my method ?does Iqueryable type close connetion automatically?
i use this code in slc method  but it hase error
pubic cLass myclass
{
public IorderdQueryable<contactTbl> slc()
{
using(DataContext DataConextVar = new DataContext(cnclass.GetConnectionString("ConnectionString")))
{
  var t=from b in DataConextVar.contactTbl select b;
return t;
}
 
please help me
}
 
 
 
 
 
 
Answers (1)
0
Sam Hobbs

Sam Hobbs

NA 28.7k 1.3m 14y

I don't find IorderdQueryable in the MSDN.
 
IQueryable does not have a connection so it does not have a connection to close automatically.