My LINQ query is not producing the expected output below. Basically, it's the sum of table3.cost corresponding to table2.code and table2.class categorized by table1.alias and ordered by table1.priority. I added two DataRelation's to the DataSet:
ds.Relations.Add("Table1Table2", ds.Tables[1].Columns("ID"), ds.Tables[2].Columns("ParentI...
This is very confusing, I use AsDataView to bind query result to a dgv and it works fine with the following:
var query = from c in myDatabaseDataSet.Diamond where c.p_Id == p_Id select c;
dataGridView1.DataSource = query.AsDataView();
However, this one results in an Error:
var query = from item in myDatabaseDataSet.Items
where it...
The following query works as long as I can add DataRelations. However, the relation "Table2Table3" may no longer be clearly defined, so I think I need to remove it. The old relation strictly joins on 2 string fields. The new relation exists if Table2.code = Table3.code and Table2.class = Table3.class OR Table2.code = Table3.code and Tabl...
I have a mobile app that is using LinqToDatasets to update/insert into a SQL Server CE 3.5 File.
My Code looks like this:
// All the MyClass Updates
MyTableAdapter myTableAdapter = new MyTableAdapter();
foreach (MyClassToInsert myClass in updates.MyClassChanges)
{
// Update the row if it is already there
int result = myTableAd...
Is LINQ to Dataset subset of LINQ to EF or these two are independent?
...
hi, i've got a problem with dataset:
I've got two dataset from two different server but they have the same columns.
so it's like that:
First DataSet :
asset description make jobtype jan feb ... dec
0001 mine ik Acc 0 0 10
0002 yours ic Over 0 0 10
Second dataset :
asset description make ...
This works:
from x in table.AsEnumerable()
where x.Field<string>("something") == "value"
select x.Field<decimal>("decimalfield");
but, this does not:
from x in table.AsEnumerable()
.Where(y=>y.Field<string>("something") == "value")
.Select(y=>y.Field<decimal>("decimalfield"));
I also tried:
from x in table.AsEnumerable()
.Where(y=...
Does any one know of an example on how to store an image in a SQL Server CE database?
What data type should the column be? (I am guessing binary.)
I use Linq-To-Datasets. Is it possible using that to put the image into the database and pull it out again later?
Thanks for any advice.
Here is how I did it:
MemoryStream stream = ne...
I need to get the minimum DateTime value of a column in a DataTable. The DataTable is generated dynamically from a CSV file, therefore I don't know the name of that column until runtime. Here is code I've got that doesn't work...
private DateTime GetStartDateFromCSV(string inputFile, string date_attr)
{
EnumerableRowCollection<Data...
Can I do a LINQ Join from an List to a DataSet? Are there any caveats to doing this?
...
I've got the following LINQ Statement:
Dim PSNum As Integer = 66
Dim InvSeq = (From invRecord In InvSeqDataSet.RptInvSeqDT.AsQueryable() _
Where IIf(invRecord.IsPack_NumNull(), False, invRecord.Pack_Num = PSNum) _
Select New With _
{.Inv = invRecord.Invoice_Num, .Seq = invRecord.Inv_Seq})...
This is my first question and first day in Linq so bit difficult day for me to understand.
I want to fetch some records from database
i.e.
select * from tblDepartment
where department_id in
(
select department_id from tblMap
where Guest_Id = @GuestId
)
I have taken two DataTable. i.e. tblDepartment, tblMap
Now I want to fe...
I have created this query to fetch some result from database.
Here is my table structure.
What exaclty is happening.
DtMapGuestDepartment as Table 1
DtDepartment as Table 2
Are being used
var dept_list= from map in DtMapGuestDepartment.AsEnumerable()
where map.Field<Nullable<long>>("GUEST_ID") =...
This is not working. Returns Null to dept_list.
var dept_list = ((from map in DtMapGuestDepartment.AsEnumerable()
where map.Field<Nullable<long>>("Guest_Id") == 174
select map.Field<Nullable<long>>("Department_id")).Distinct())as IEnumerable<DataRow>;
DataTable dt = dept_l...
var dept_list = (from map in DtMapGuestDepartment.AsEnumerable()
where map.Field<Nullable<long>>("GUEST_ID") == DRowGuestPI.Field<Nullable<long>>("PK_GUEST_ID")
join
dept in DtDepartment.AsEnumerable()
on map.Field<...
I have a SQL Compact Edition Database that I update periodically (via web services).
The part where I write to the database is taking way too long. I am currently doing it with Linq to Datasets (as seen in this question). I have heard that if I do it with with SQLCeResultSet that it will work faster.
So, given that I have a table lik...
I am trying to get distinct rows based on multiple columns (attribute1_name, attribute2_name) and get datarows from datatable using Linq-to-Dataset.
I want results like this
attribute1_name attribute2_name
-------------- ---------------
Age State
Age weekend_percent
Age statebreakl...
I have two DataTables one is Primary Table and the rest is a sub table (I AM UISNG STRONGLY TYPED DATASET).
Example
Employee Table
Id Name City
1 AAA NY
2 BBB BB
3 CCC AA
CityInitials Table
CityInitial
NY
FF
CC
RR
RNF
YOT
DDD
I have to select rows from employee table only when the 'city' in Employ...
how to return a dataset from linq in .net 3.5?
I have seen in some sites that CopyToDataTable method is used but I am not able to use that methos as I cannot find System.data.datatableextensions reference in the ref list.
Please help me out.
Thanks and regards,
veena
...
What changes do i need to make so as to reduce of doing this task with fewer lines and better approach.
DataTable dtStatusMsgs;
var statusList = (
from items in dtInputTable.AsEnumerable()
where items.Field<int>("DepartmentId") == deptId
select new
{
...