I'm trying to connect my gridview to a LinqDataSource to select, update, insert and delete records. I am able to get into edit mode and cancel out of edit mode but when I click update nothing happens.
I've found a few things online that say to check the "Enable Editing" box in the gridview smart tag but when I go into the smart tag t...
I have a list of objects and I'd like to update a particular member variable within one of the objects. I understand LINQ is designed for query and not meant to update lists of immutable data. What would be the best way to accomplish this? I do not need to use LINQ for the solution if it is not most efficient.
Would creating an Update ...
I am having an issue adding an item to my dataset in Linq to SQL. I am using the exact same method in other tables with no problem. I suspect I know the problem but cannot find an answer (I also suspect all i really need is the right search term for Google). Please keep in mind this is a learning project (Although it is in use in a busin...
Here I have an arbitrary IEnumerable<T>. And I'd like to page it using a generic helper function instead of writing Skip/Take pairs every time. Here is my function:
IEnumerable<T> GetPagedResults<T>(IEnumerable<T> query, int pageIndex, int pageSize)
{
return query.Skip((pageIndex - 1) * pageSize).Take(pageSize);
}
And my code is:
...
Python's equivalent of what I want is:
>>> #C#: Dictionary<int, string> tempDict = ...
>>> tempDict = {i : str(i) for i in range(200000)}
>>> tempDict[5]
'5'
>>>
The example is a bit simplified, but I can modify it myself; do not want to bother you with details of proprietary classes.
Got it:
var y = (from x in Enumerable.Range(0, ...
I am trying to do a join with a sub query and can't seem to get it. Here is what is looks like working in sql. How do I get to to work in linq?
SELECT po.*, p.PermissionID
FROM PermissibleObjects po
INNER JOIN PermissibleObjects_Permissions po_p ON (po.PermissibleObjectID = po_p.PermissibleObjectID)
INNER JOIN Permissions p ON (po_p.P...
I'd like to implement MVC while using LINQ (specifically, LINQ-to-entities). The way I would do this is have the Controller generate (or call something which generates) the result-set using LINQ, then return that to the View to display the data. The problem is, if I do:
return (from o in myTable select o);
All the columns are read f...
Hi all,
I have the following class
public class CountrySpecificPIIEntity
{
public string Country { get; set; }
public string CreditCardType { get; set; }
public String Language { get; set; }
public List<String> PIIData { get; set; }
}
I have the following XML that I want to query using Linq-to-xml and shape in...
For a utility I'm working on, the client would like to be able to generate graphic reports on the data that has been collected. I can already generate a couple canned graphs (using ZedGraph, which is a very nice library); however, the utility would be much more flexible if the graphs were more programmable or configurable by the end-use...
The following code:
var constant = Expression.Constant("find me", typeof(string));
// memberExpression evaluates to a string
var predicate = Expression.Call(memberExpression, "Equals", null, constant);
is throwing the error More than one method 'Equals' on type 'System.String' is compatible with the supplied arguments.
I'm guessing ...
Does anyone know if it is possible to use LINQ to query a NETEZZA back-end?
Update: I've tried both the ODBC and OLEDB Netezza drivers, but neither work. Both give a "The selected object(s) use an unsupported data source" error.
...
public static ArrayList GetStudentAsArrayList()
{
ArrayList students = new ArrayList
{
new Student() { RollNumber = 1,Name ="Alex " , Section = 1 ,HostelNumber=1 },
new Student() { RollNumber = 2,Name ="Jonty " , Section = 2 ,HostelNumber=2 }
};
return students;
}
The following code doesn't compile. ...
I can change SQL at runtime.
Can I do the same with LINQ ?
Can I have LINQ queries coming from an xml file, which I can edit at runtime ?
...
Hello
How can I get the Nth row using Linq? both columns are text so I cant use min/max
/M
...
Note that the _src inherit IQueryable<U> and V inherit new();
I wrote the following statement, there is no syntax error.
IQueryable<V> a = from s in _src where (s.Right - 1 == s.Left) select new V();
But if i RE-wrote it as follows, the Visual Studio editor complains an error in the "Select"
IQueryable<V> d = _src.Where(s => s.Right...
Hi, I've got a list of 'double' values. I need to select every 6th record. It's a list of coordinates, where I need to get the minimum and maximum value of every 6th value.
List of coordinates (sample): [2.1, 4.3, 1.0, 7.1, 10.6, 39.23, 0.5, ... ]
with hundrets of coordinates.
Result should look like: [x_min, y_min, z_min, x_max, y_max...
I have an XML structure that has many doc nodes, and each node may have zero or more extract paragraphs (paras).
<doc>
<docitem>3</docitem>
<docid>129826</docid>
<doctitle>sample title</doctitle>
<docdatetime>2009-07-03T16:59:00</docdatetime>
<collectdatetime>2009-07-03T16:59:23</collectdatetime>
<summary>
...
I'm still trying to get my head round how to use LINQ-to-SQL correctly, rather than just writing my own sprocs.
In the code belong a userId is passed into the method, then LINQ uses this to get all rows from the GroupTable tables matching the userId. The primary key of the GroupUser table is GroupUserId, which is a foreign key in the Gr...
Hi,
I have an XElement object which has a number of attributes and I simply want to add another attribute to the element.
How do I do this?
Thanks,
Matt.
...
Hi All,
I have an Entity model with Invoices, AffiliateCommissions and AffiliateCommissionPayments.
Invoice to AffiliateCommission is a one to many, AffiliateCommission to AffiliateCommissionPayment is also a one to many
I am trying to make a query that will return All Invoices that HAVE a commission but not necessarily have a related...