 |
|
 |
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
|
 |
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
|
 |
want to do execute a LINQ query, and I have the name of the table to query stored in a variable:
string tableName = "SomeTable"";
DataContext db = new DataContext();
var vResult = from t in db.tableName
where t.Id = ....
|
|
|
|
 |
|
 |
Hi, I have a list like List<Keypair<int,List<Items>> X where Items is a class... and another List like List<StudentTasks> Y where StudentTasks is a class which contains two variables PersonnelNumber(int),Iseligible(bool)....... In the above list X contains personnelnumber(int) which is the key for each list member in X... In the above list Y contains personnelnumber(int) which is one of the variable in each list member (ie StudentTasks )... actually the personnelnumbers in X were the subset of personnelnumbers present in Y which even contains personnal numbers other than in X....So as now Please let me knoiw how to fetch personnelnumbers from Y(which were present in X) and the associated Iseligible values from Y... and need to create a new Dictionary like var q=new Dictionary<int,bool>() where this should be populated with values from the above resultset...ie...key as personnelnumbers and iseligible as value....
|
|
|
|
 |
|
 |
Hi could you please supply the source code of the collections. thanks
|
|
|
|
 |
|
 |
hi
i m getting trouble if i use exec statment in stored procedure and when i m trying to fetch data with that stored procedure with linq then it error.
if i use exec command then it will not dispaly list() like below
LS25DataContext mydb = new LS25DataContext();
list<Customer> IResult = mydb.usp_search(int custid,int iprice).ToList() ;
can i use exec command in stored procedure when use linq?
please help me
thanks in Advance.
|
|
|
|
 |
|
 |
Hi I am struggling with this linq query:
var query = (from b in db.Builders where b.UserID==Login.User.Identity select b).ToList();
The compiler yells at me.
What am I missing?
Thank You in advance.
Frazzle the name say's it all
|
|
|
|
 |
|
 |
What exactly is the compiler yelling ?
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
 |
|
 |
I fixed it now I know to use the HttpContext. I wish to thank You for answering My post.
Frazzle the name say's it all
|
|
|
|
 |
|
 |
Why was this Down voted? Am I doing this wrong? Is there a better way? I am a noob and would like to learn so please tell Me if there is a better way.
Thanks in advance
Frazzle the name say's it all
|
|
|
|
 |
|
 |
Guess it was a nonsense univoter. Fixed it as what you did was the right thing. If you find the answer yourself, then definitely post the solution, as other people may run into the same problem, and your solution may save someone else a few hours.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
 |
|
 |
I have an Sp which takes a userdefinedtabletype as one of the parameter,and now i need to call this Sp from my c# code. I created a dbml file and i created a class which simulates my userdefinedtabletype in DB. Now the issue is there is a column named **version** which of type TMESTAMP is present in the Udtt in SP And the structure of udtt in DB is as follows. CREATE TYPE dbo.sampletype as ID INT NULL, Name String NULL, Version TIMESTAMP So when i created a class i created VERSION column as below.. global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Version", DbType="rowversion NOT NULL")] public System.Data.Linq.Binary Version { get { return this._Version; } set { if ((this._Version != value)) { this._Version = value; } } } Now when i call SP using classic ADO.net(using cmdparameters,SqlExecuteReader) im getting the below error.. The type of column 'Version' is not supported. The type is 'Binary' Please help me regarding the same.
|
|
|
|
 |
|
 |
Hello everyone.
First i ask sorry for my poor enlish, but i will try to explain myself in the best way i can.
What i wish to know is:
Make a generic query to get one record from the database using the id's fields. But the number of the ids fields(and its types) different from table to table. I intend to build a LINQ query and mix T-SQl code to build the WHERE expression. Something like that:
var query = from e in dbContext.ObjectSetNameToextractFrom(*)
includeThis("WHERE id1 = value1 AND id2 = value2....")
select e;
(*) the name of the table where i want to extract the unique record from .
Thanks ofr your help.
Best regards, jonatan
|
|
|
|
 |
|
 |
Hi all,
i want to bind datatable using linq query, can you please have a look on below mentioned query ,i am getting error.
public DataTable BindCustomername()
{
DataClasses1DataContext odeptdataclass = new DataClasses1DataContext();
DataTable odtname = new DataTable();
var name = from p in odeptdataclass.Tbldepts
select new
{
p.deptid,
p.deptname
};
odtname = name.ToString();
return odtname;
}
i am getting Error:Cannot implicitly convert type 'string' to 'System.Data.DataTable'
how to do that give me idea.
Thanks
Rama
|
|
|
|
 |
|
 |
rama2011 wrote: odtname = name.ToString();
return odtname;
Your problem lies in those 2 statements. You create a DataTable called odtname, but then you try and assign the results of your query as a string to the DataTable. You are going to have to iterate through the results of the query, assigning each returned row to the DataTable, and then return the Table.
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
 |
|
 |
Hi,
how to bind datatable using linq query, can you please give me idea
copytodatatable option is not showing
Regards
rama
modified 24 Nov '11.
|
|
|
|
 |
|
 |
First off, never reply or post a question in capital letters, it is considered extremely rude. For your problem try here - (MSDN)[^].
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
 |
|
 |
Your problem is in this line odtname = name.ToString(); Because odtname is defined as DataTable and you try to assign an string.
|
|
|
|
 |
|
|
 |
|
 |
Try this:
private static bool IsStringInList(List<string> sentences, string seek)
{
var seekList = seek.Split(' ');
var plainList = sentences.SelectMany(x => x.Split(' '));
var result = plainList.Intersect(seekList).Any();
return result;
}
|
|
|
|
 |
|
 |
+5 I haven't tested this yet, but I appreciate your sharing such an interesting use of Linq !
thanks, Bill
"Science is facts; just as houses are made of stones: so, is science made of facts. But, a pile of stones is not a house, and a collection of facts is not, necessarily, science." Henri Poincare
|
|
|
|
 |
|
 |
I don't use this stuff but it occurs to me that you could do a count() query first, test the value and then do the datatable query!
Never underestimate the power of human stupidity
RAH
|
|
|
|
 |
|
 |
Have you tried getting a list of all the rows and then do a CopyToDataTable
dim query=(from customers in dtcustomers.asenumerable
where customers.state = "VA"
select customers).ToList
dim dtNewTable as datatable=query.copytodatatable
|
|
|
|
 |
|
 |
Out of the box EF4 entity objects do not support serialization. You need to convert your model to POCO objects using the ‘ADO.NET POCO Entity Generator’ or the ‘ADO.NET DbContext Generator’(depending on your EF4 version). This can be done automatically by right-clicking on the model design surface and selecting ‘Add Code Generated Item’. From the dialog, select ‘Online Templates’ and the desired generator. Type a name for your T4 template (your model name). A simple POCO class will be created for each entity. To send and receive the POCO classes over the wire via WCF you will need to add some class files/ class project (CyclicReferencesAware and DataContractResolver) and some supporting attributes to the code generated web services interface classes. Here are some links (walk troughs) that explain the process. http://www.sanderstechnology.com/2010/the-ado-net-entity-framework-poco-objects-and-you/10142/ http://blogs.msdn.com/b/adonet/archive/2010/01/25/walkthrough-poco-template-for-the-entity-framework.aspx
|
|
|
|
 |
|
 |
hi,
check this link.
it is opensource .net project. you can learn lot more things from this.
thanks
-amit.
|
|
|
|
 |