|
Dear Sir/madom
I have three tables
1. Categorys (ID, Name)
2. Definitions (ID, Name, CategoryID)
3. Versions( ID, Name, DefinitionID)
I have generated three objects using EDM
1 Cagegorys
Navigation (Definition)
2. Definitions
Navigation (Category, Version)
3. Versions
Navigation (Definition)
I want to get latest versions against each category
My Code is as follow It return all version against the categoryId but I want to get only latest version of each definition against a category.
DataEntities data = new DataEntities();
Category cat = (from c in data.Categorys where c.ID == CategoryID select c).First();
IList<definition> defintions = (from d in data.Definitions.Include("Versions") where d.Category.ID == cat.ID select d).ToList();
IList<dynamicforms.data.version> versions;
if (defintions.Count>0)
{
versions = defintions.SelectMany(d=>d.Versions).ToList();
Grid.DataSource = versions;
Grid.DataBind();
}
If I need sub query How I have construct and use subquery in this code
Your early reply will be highly appriciated please.
|
|
|
|
|
I have been searching the net for 2 months now looking for info on how to do this. Can anyone point me in the right direction?
I have a vb.net program that used SendKeys to send ctrl+C and CTRL+V that was able to do this but I can't get that to go in VS2008 C#.
tia
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
You're kidding right, 2 months wow!
There are a number of options
Context menu gives you right click on the node and deal with the menu option including ctrl C/V
Trap the keydown method on the node for the ctrl C, grab the node and set a flag that a node is copied, trap the next key down for the ctrl V and add the copied (cloned) node to the current selected node.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yea really...I think if you look you will see some eariler posts going back a couple of months.
I have tried that...all I seem to get is the highlighted node I get none of the child nodes.
Originally this was a VB.net app done with VS2003 they used SendKeys CTRL+C and CTRL+V and it works fine.
Now I am trying to upgrade to C# using VS2008 and the above no longer works (don't get the child nodes)
Any other Ideas??
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
I guess you are copying the selected node and assuming the child nodes are in there - sounds like you need to get the whole structure of child nodes manually during the copy process.
I also presume you are copying the selected node to the clipboard and then pasting from the clipboard and accepting those limitations. This is useful only if you are moving off the app/form/control where you are copying from (and thereby losing the original structure). If it is inside your app why not grab a placeholder on the copy event and when the paste is done go and get the entire structure from the original node.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The way it worked in the old app was they were copying the selected node and pasting using the clipboard. This copies the selected node and all of its child nodes. (they were using the sendKeys CTRL+C and CTRL+V).
The few examples I have found on the net were just the simple copy and paste of the selectedNode.
I have also tried cloning but have not gotten that to work either.
If you have an example or a link to a good example I would be most greatful.
It seems like it should be a simple task but I guess if it was there would be some meaningful examples.
tia
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
Hi there!!
My problem is when i am switching to another SQL SERVER with my project then every time i have to change my connection string.
Is there any way to solve this problem??
|
|
|
|
|
KIDYA wrote: My problem is when i am switching to another SQL SERVER with my project then every time i have to change my connection string.
Why is that a problem? Surely you are storing your connection string in the config file. Or have you hard coded it in to the application itself?
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
I have it in config,Now tel me other way.
Please!!!
|
|
|
|
|
KIDYA wrote: I have it in config,Now tel me other way.
What specific problem do you have with having the connection string in your config file?
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
i want common connection string thr' which i can run my project on any server withput changing config connection string.
|
|
|
|
|
..and how will you know how the SQL-server instance on my PC is called?
I are troll
|
|
|
|
|
you can store such information in a database!
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Telepathic software, the next wave of future development, just think about where you want to be!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Tele: meaning remote
Pathetic: standing for the quality
|
|
|
|
|
You can have several connection strings in the same config file. You can design your application in such a way that it prompts the user to select which environment it wants to connect to and then fetch the appropriate connection string from the config file.
|
|
|
|
|
Assume you booked a Air Ticket for California. Now you have changed your mind and decided to go to Paris. What do you think, the same ticket will work? Sorry, just kidding. If you are changing the database, the connectionstring also needs to be changed either in config file or in every places where it is used.
Regards
Saanj
Either you love IT or leave IT...
|
|
|
|
|
I think what you are looking for is "localhost".
If you set the server name in the connection string to "localhost" it will connect to the SQL server running on the local PC.
You need to explain your question in more detail and explain what you are trying to do, your question is not clear at all.
Simon
|
|
|
|
|
Thanx dude!! u only gave my answer.
|
|
|
|
|
My pleasure.
The reason that you didn't get any other good answers is because you question was very unclear and difficult to understand.
I'm not talking about the quality of your English (that's fine), but about how well you describe your problem. Next time you post a question, take the time to properly describe the situation you are in, the problem you are having, and what you are trying to achieve.
Simon
|
|
|
|
|
KIDYA wrote: My problem is when i am switching to another SQL SERVER with my project then every time i have to change my connection string.
That will always be the case.
The only solution, that I can think of, there may be others but they escape me for now.
1. Try connecting using your stored connectionstring, catch exceptions and when the exception shows database absent
2a. Create a clone of the MS Server Connection Dialog and let the user 'find' the right server. OR
2b. Iterate over all available servers and do 1. above uon each one ntil you find the database, then modify the current connectionstring to match.
You might find it useful to read up on the ConnectionStringBuilder class for a fairly easy way to modify connection strings.
You might also want to download the SQLServer 2008/2005 Samples from Microsoft Download site for an example of cloning the dialog. If you do so an example will be found at YourDrive:\YourBaseDirectory\Samples\Engine\Programmability\SMO\ServerConnect\CS\ServerConnect.
In the Samples directory tree you will also find examples of how to find all available servers, so you can iterate over them, if you decide to do it that way.
Of course whichever way you do it, you will be faced with the problem of how and where to store the modified connection string.
Good Luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello Experts!!
During adding records into datagridview i want to prevent duplicate values adding,i am saving multiple values at a time.when i enter duplicate value into specific column then it must show msg for same.
now i am using cell changed event.
|
|
|
|
|
Set the constraint on the column in the DB itself.
जय हिंद
|
|
|
|
|
|
can you please provide source code to prevent entering duplicate values in mysql using aspx
|
|
|
|