 |
|
 |
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
|
|
|
|
 |
|
 |
what is linq. whay it is used for.
|
|
|
|
 |
|
 |
Typing your question, or rather simply the word LINQ, into Google, reveals lots of information[^].
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
 |
|
 |
I've seen some good information on this site as to how to set up a Windows Forms application using the Entity Framework and Data Binding the controls on the forms to the Entity Framework. And also have a SQL Server at the bottom of the stack. But, there is one thing that I don't understand. I could be missing something. But it seems that, in the examples that I've seen, that the Form controls, the entity framework, and the binding between are all running off of the same thread. If that's true, then I would think that I could expect the UI to appear to hang while waiting on a round trip query to the Database. It would seem that it would be better to make any Database query run in a separate thread for performance reasons. Or, perhaps it's the case that optimizations along these lines take place, by default, under the hood in ObjectContext and I just don't know it. Could someone please enlighten me?
|
|
|
|
 |
|
 |
Hi all
How can I use with linq command like this:
INSERT INTO tablename1 (column1, column2, column3,...)
SELECT (column4, column5, column6,...) FROM tablename2
I hop to be clear
Thanes
modified 10 Apr '12.
|
|
|
|
 |
|
 |
I think you could do something like this:
var SeletcToInsert = from tbl2 in tablename2
where ...
select new A
{
...
};
tablename1.InsertAllOnSubmit(toInsert);
dc.SubmitChanges();
|
|
|
|
 |
|
 |
I have 1 WinForm with 2 Combo boxes, first one is filled with Employee names, and the second one is supposed to be filled with tasks that are affected to every employee listed in the first combo. But could not get the following code to run for the second combo:
private void Form1_Load(object sender, EventArgs e)
{
using (LINQtoEntitiesEntities MyEntities = new LINQtoEntitiesEntities())
{
ObjectQuery Emp = MyEntities.Employee;
comboBox1.DataSource = (from u in Emp select new { u.ID, u.LastName }).ToList();
comboBox1.ValueMember = "ID";
comboBox1.DisplayMember = "LastName";
}
}
private void comboBox1_TextChanged(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex.ToString() == "0") return;
using (LINQtoEntitiesEntities MyEntities = new LINQtoEntitiesEntities())
{
label1.Text = comboBox1.SelectedValue.ToString();
ObjectQuery Tsk = MyEntities.Tasks;
comboBox2.DataSource = (from t in Tsk where t.EmloyeeID.ToString() == comboBox1.SelectedValue.ToString() select new { t.ID, t.TaskName }).ToList();
comboBox2.ValueMember = "ID";
comboBox2.DisplayMember = "TaskName";
}
}
Could fill normally ComboBox1, but not ComboBox2, and it would be great if first line of ComboBox1 is blank.
|
|
|
|
 |
|
 |
Does the event fire for comboBox1_TextChanged, if not rather try the SelectedIndexChanged event.
If EmployeeID is an int, rather convert to toInt32 than toString, reason is that "1" != "1 ", so it is better practice to compare int values.
Sami L wrote: (from t in Tsk where t.EmloyeeID.ToString() == comboBox1.SelectedValue.ToString()
int selectedID;
if(int.TryParse(comboBox1.SelectedValue.ToString(), out selectedID))
{
comboBox2.DataSource = (from t in Tsk
where t.EmloyeeID == selectedID
select new { t.ID, t.TaskName }).ToList();
}
To insert an empty value first in comboBox1 use the insert command after setting the datasource in the form load. the index will be 0 to insert as the first item.
comboBox1.Items.Insert(index, object);
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
 |
|
|
 |
|
 |
What is "a"?
Please refer Guidelines before you start new thread.
Hope you understand.
|
|
|
|
 |
|
 |
AFAIK a is how most alphabets start
|
|
|
|
 |
|
 |
Not a good start to your CP life!
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
 |
|
|
 |
|
 |
You do realize you have pointed to the same question, the code given my the OP is the same, and gave the same useless answer, Use reflection, with no elaboration.
Failure is not an option; it's the default selection.
|
|
|
|
 |
|
|
 |
|
 |
Please give us sample code to work out.
|
|
|
|
 |
|
 |
I Googled and found many answers.
Hope this help!
|
|
|
|
 |
|
|
 |