C# LINQ Unable To Enumerate Matrix
Aug 31, 2010
I declared a 3 X 3 Matrix
int[,] matrix=new int[3,3]
{
{1,2,3},
{4,5,6},
{11,34,56}
};
when i try to enumerate it like var diagonal = matrix.AsQueryable().Select(); I am unbale to convert it as enumerable collection.How to do that?
View 2 Replies
Similar Messages:
Nov 23, 2010
I have declared a simple class
[Code]....
And Pass some values to it :
[Code]....
Then I use Linq to select rows :
[Code]....
How I can enumerate it?! I used this, but it has error
[Code]....
View 3 Replies
Jun 1, 2010
I've got a data table with columns in which include Item, Category and Value (and others, but those are the only relevant ones for this problem) that I access via LINQ in a C# ASP.Net MVC app. I want to transform these into a matrix and output that as a CSV file to pull into Excel as matrix with the items down the side, the categories across the top and the values in the row cells. However, I don't know how many, or what, categories there will be in this table, nor will there always be a record for each item/category combination.
I've written this by looping round, getting my "master category" list, then looking again for each item, filling in either blank or Value, depending on whether the item/category record exists, but as there are currently 27000 records in the table, this isn't as fast as I'd like. Is there a slicker and faster way I can do this, maybe via LINQ (firing into a quicker SQL statement so the DB server can do the leg-work), or will any method essentially come back to what I am doing?
View 2 Replies
Jul 18, 2010
Using Visual Studio I've created a DBML file, and added a table to it from a local database. This created a data context called UserDataContext. In my ASPX page I can create an instance of the data context using:
UserDataContext db1 = new UserDataContext();
However when I try to query against the table I get to:
var query = from o in db1.
and from there I can't see the table.... the dbml shows the table has public access.
View 6 Replies
Aug 3, 2010
var response = _facebookAPI.Fql.Query(String.Format("SELECT uid FROM event_member WHERE eid={0}", myevent));
I would like to convert response to List<long> uids
View 1 Replies
Dec 1, 2010
private void EnableControls(bool enable)
{
foreach (TextBox t in Page.Form.Controls.OfType<TextBox>())
[code]...
View 2 Replies
Jan 29, 2011
I am working on LINQ. I am calling a SQL Stored Procedure with 2-3 parameters it's working fine. When i am going to call Stored Procedure with 8 to 9 parameters the auto generated column is not comming automatically. So i am unable to use LINQ with Stored Procedure with multiple parameters.
View 4 Replies
Aug 16, 2010
I'm unable to fetch just one integer value using this LINQ-query. LINQ seems to return everything as IEnumerable but I don't want that. First query should return just one string value which is then used in another query. That one should return integer which is also return value for method:
public static long GetTableIdByTableName(string name)
{
var result = (from aTable in objScope.Extent<Table>()
where aTable.Name == name
select { aTable.Id });
return ???????????
}
View 1 Replies
May 14, 2010
I'm trying to enumerate through all the Controls of a Page, but all I can find is thePage.FindControl(string) and the .Controls property doesn't has the controls that I have on the page. Anybody knows how to enumerate through all the controls of a web-forms page
View 2 Replies
May 27, 2012
I need to be able to pick out every Monday between two dates. I have worked out how to see if a given date is a Monday but I can't find any way to loop through each day between two dates?
View 1 Replies
Feb 13, 2011
I have created a load of dynamic buttons in an update panel. I do this so that there is one button for each client name in my DB. I want to then go through a list of these buttons and change the colour of them depending on another value retrieved from my database. How can I get a list of the buttons that have been created on my update panel. What would be the best method to update the colour as soon as they have been created? Would I use the preRender to create the button objects and then use the form load to update their colour or is there a better way of doing this?
View 1 Replies
Feb 20, 2010
I have downloaded Visual Web Developer 2010 Express and am trying to use LINQ. In order to do that I have added a LINQ to SQL class to the web site and have dragged tables from the database view into the LINQ designer, which worked fine.But..When I add: using System.Data.Linq;to MainPage.xaml.cs, I receive an error:
Error 3 The type or namespace name 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?)Even although I have references to System.Core, System.Data, System.Data.Linq in the website references.
View 4 Replies
Sep 23, 2010
For some unknown reason I suddenly am unable to create an object variable for a Linq Data Class. If I create a new project and try the process again with the same database everything works as advertized.The code I am using is Dim db As New RoggDataContext which gives me an error on the object variable "db": Overload resolution failed because no accessibility 'NEW' accepts this number of arguments.I have looked inside every file in the Web Project like the web config to check the connection string, gobal, and designer.vb looking for any errors whit no JOY. I also tried to create a new form and code behind with a button and received the same error.This is mind blowing because as I already stated, I can create a new Web Site and the problem goes away.
View 3 Replies
Mar 28, 2011
I have a database table called Animals which I drag on to my Linq to SQL DBML file.
This creates me a class called Animal.
I then create a class to extend it, like so:
public partial class Animal{
//my extra code here
}
But what I also want to do is have a class like this:
public class Zebra : Animal{
//even more extra code here
}
The trouble is I get an InvalidCastException from my repository, when I do this:
Animal a = dataContext.Animals.Where(c=>c.id.Equals(id)).SingleOrDefault();
return (Zebra)a;
I've stripped back my classes to the point where they're completely empty in an attempt to work why it doesn't work. To no avail.
This casting process did used to work in the non-LINQ-2-SQL project that I'm switching to MVC/LINQ.
View 1 Replies
Apr 20, 2010
I have a ASP.NET (C#) web page in which I want to enumerate a dictionary in a code render block:
<% foreach (Dictionary<string, string> record in parsedData) { %>
<div>...Some HTML Code...</div>
<% } %>
But I get an error like:
Compiler Error Message: CS0246: The type or namespace name 'Dictionary' could not be found (are you missing a using directive or an assembly reference?)
How do I import System.Collections.Generic into the page itself? Here is my page directive:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyCSharpClass.aspx.cs" Inherits="_MyCSharpClass" %>
View 3 Replies
Sep 16, 2010
Within my Outlook (under Folder List) I have the following public folder: Public Folders ---> All Public Folders ---> Corporate Contacts. The "Corporate Contacts" folder holds a number of Contact objects. Using LDAP I'm trying to locate this public folder ("Corporate Contacts") and enumerate through the contacts in order to produce a client list. I'm using DirectorySearcher.Filter = "(&(objectClass=publicfolder))" to pull out the list of public folders but all I get is:
CN=Default
CN=exchangeV1
CN=globalevents
CN=internal
CN=microsoft
CN=OAB Version 2
CN=OAB Version 3a
CN=Offline Address Book - /o=Company Ltd/cn=addrlists/cn=oabs/c
CN=Offline Address Book - First Administrative Group
CN=OWAScratchPad{4F2AEF03-46EB-4086-AB7A-CE8FD05FBD14}
CN=StoreEvents{4F2AEF03-46EB-4086-AB7A-CE8FD05FBD14}
CN=Schedule+ Free Busy Information - First Administrative Group
CN=schema-root
Whatever I try I cannot seem to find the "Corporate Contacts" public folder. Can someone offer any pointers or assistance on this as its beginning to drive me crazy!
View 1 Replies
Oct 7, 2010
The oddity is, that the same website files, copied and pasted, connection string altered to point to the production/live db, published to the httpdocs folder works fine BUT the same web files, copied and pasted, connection string altered to poin to the dev db, published to the subdomains/dev fodler causes the error below:
------ Build started: Project: AHN, Configuration: Debug Any CPU ------
AHN -> P:Web_DevelopmentxxxDEVinxxx.dll
------ Publish started: Project: xxx, Configuration: Debug Any CPU ------
Connecting to ftp://xxx.co.uk/subdomains/dev/httpdocs...
Transformed Web.config using Web.Debug.config into
objDebugTransformWebConfig ransformedWeb.config.
Copying all files to temporary location below for package/publish:
objDebugPackagePackageTmp.
Deleting existing files...
An error occured trying to enumerate the contents of folder ''. Can't
open data connection (425).
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
When I asked the hoster whats going on, he obsiously that its not his fold because the publishing is
working for the non-subdomain (dev) site. Moreoever I deleted and recreated the /dev subdomain but the
error is the same.
View 4 Replies
Mar 31, 2010
I wanted to delete the record from data but I receive this error "Unable to cast object of type 'System.Data.Linq.DataQuery`1[training_eval.Course]' to type 'training_eval.Course'.
Dim eval_sure = From ev In db.Evaluates Where ev.course_id = indexcourse Select ev.course_id
Dim del_course = From c In db.Courses Where c.Course_id = indexcourse
db.Courses.DeleteOnSubmit(del_course)
db.SubmitChanges()
View 4 Replies
Apr 12, 2010
I am using Visual Studio 2008. Last few days I am getting an error while trying to add or update web reference.
"The components required to enumerate web references are not installed on this computer. re-install Visual Studio."
I tried some commands like "C:Program FilesMicrosoft Visual Studio 8Common7IDE>devenv /resetskippkgs" in VS Command prompt, still I am getting the same problem.
I also found in one post to uninstall "Microsoft Source Analysis Tool For C#" from the machine. But in my machine the tool is not installed.
View 3 Replies
Apr 13, 2010
I'm using reporting services in visual studio 2005.
I'm using a matrix and it looks like this.
[code]....
View 8 Replies
Jan 17, 2011
I normally use Wordpress on a Linux hosting. Can I use WebMx with Linux Hosting?I didn't found the FAQs of this forum.
View 3 Replies
Sep 14, 2010
I am trying to make the header of a matrix scrollable. I have tried the coloumn and row group editing to check the scrollable option.
Only the rows that are grouped are scrolling on checking the scrollable option but not the coloumns.
I have a coloumn group as static coloum. When I edit it to check the srollable option, it gives an error "The properties of the currently selected item is not valid. correct all erorrs before continuing". And for the Static group in coloumns I get only the add option and not the edit option. What should be done in this case?
View 1 Replies
Feb 17, 2011
Microsoft has a new website editing tool: WebMatrix. WebMatrix uses the new Web Pages engine in which Razor is the view engine; Razor is also the new view engine for MVC3. I am attempting to find out if it is possible to register and use a different view engine in Web Pages (like you can in MVC).Does anyone know if it is possible to add or replace the view engine in Web Pages? If so has anyone documented this? Examples?
View 2 Replies
Jun 1, 2010
I have a matrix report with a series of drugs across the top horizontally. I have series of diseases vertically down the report. In the detail, I have a percentage that is calculated. This all works. But I want to add a column that displays vertically down the page just to the right of the diseases and to the left of the first detail. This column will contain a count of all diseases. Not sure how this will appear on this forum but I will try to illustrate below:
Total Aspirin Penicillin Tylenol Cough Syrup
Flu 10 3 6 5 12
Cold 6 4 2 9 8
Pneumonia 11 2 5 15 6
Malaria 2 4 3 9 3
Presently, my report does not have the Total column. This is what I want to add to my matrix report. And this Total column has nothing to do with the other numbers in the detail. The Total column is the count of each disease. I have no idea how to do this on a matirx report.
View 1 Replies
Aug 27, 2010
I'm using a local RDLC report in VS2008 / .NET 3.5 which includes a Matrix. It works fine and shows its corresponding Rows, Columns, and Data values as specified.
How can I add row totals / column totals in order to show sum of Data values both horizontally and vertically?
View 4 Replies