How to fill dataset using LINQ with FillDataSet(ds) Method. When iam trying to implement this code iam getting error like FillDataSet does not exist in current context.
You don't have to fill a DataSet
with LINQ2SQL. Nor do you have to use DataTable
etc. All you need is the data context and perform queries on that:
var query = from product in dtContext.emps
select product;
query
will be of type IQueryable<T>
and you can use e.g. a foreach
on it to go through its content, or filter it further with a where
clause. Why do you want a DataSet
?
From your post
FillDataSet does not exist in current context.
It clearly means that it cant access the FillDataSet method or else your method doesnt exist.
If it exists, then try changing the access specifier to public
if it is in different class.
PS: did you declare any method named FillDataSet
?
You have to define your FillDataSet(DatatSet ds)
method. Probably you should implement something similar to this example if you are following the MSDN tutorials.