|
Message Removed
modified 22-Feb-15 15:07pm.
|
|
|
|
|
Message Removed
modified 22-Feb-15 15:07pm.
|
|
|
|
|
Message Removed
modified 22-Feb-15 15:07pm.
|
|
|
|
|
Message Removed
modified 22-Feb-15 15:07pm.
|
|
|
|
|
Message Removed
modified 22-Feb-15 15:07pm.
|
|
|
|
|
Message Removed
modified 22-Feb-15 15:07pm.
|
|
|
|
|
Message Removed
modified 22-Feb-15 15:07pm.
|
|
|
|
|
Message Removed
modified 22-Feb-15 15:07pm.
|
|
|
|
|
Hello needs some help with this one:
I have a 384 days of rates a rate price and date.
I am trying to fill a graph by day of rates.
I am allowing the user to select 30, 60 or 90 days of rates within a start and end date of choosing.
I am trying to use linq to return only 30, 60 or 90 days of rates based on the start and end dates. The issue is the start and end date range could be less then let's say 30 days so I still want to return 30 days of rates.
I have not been very successful.
Thanks so much for the help.
|
|
|
|
|
And without showing your query code, there is very little anyone can do to help you.
|
|
|
|
|
You will need to adjust the start, or end, dates before making your query.
If the start date is outside the range of the available data-days:
1. if it's before the first day, then return #n data-days beginning on the first day ... or return an error.
2. if it's after the last day, then return the last #n data-days from the data ... or throw an error.
3. if the start date is in the valid range, but the user wants more data-days than are possible, decrease the start date so you can return the required data-days data.
You don't specify how exactly, given valid start and end dates you let the user choose which 30,60,90 day chunk to return, so can't comment on that.
«I'm asked why doesn't C# implement feature X all the time. The answer's always the same: because no one ever designed, specified, implemented, tested, documented, shipped that feature. All six of those things are necessary to make a feature happen. They all cost huge amounts of time, effort and money.» Eric Lippert, Microsoft, 2009
|
|
|
|
|
Hi,
is there some way to search trough sql tables using more then one row?
e.g.
string searchFor;
searchFor = textBox1.Text;
int result = 0;
DataRow[] returnedRows;
returnedRows = ds.Tables[0].Select("last_name='"+ searchFor + "'");
result = returnedRows.Length;
if (result > 0)
{
}
else
{
}
Can i search trough using first_name and/or last_name and/or age etc. and if anything is found to display data?
modified 20-Feb-15 14:30pm.
|
|
|
|
|
"
filterExpression
Type: System.String
The criteria to use to filter the rows. For examples on how to filter rows, see DataView RowFilter Syntax [C#].
"
"
To form a RowFilter value, specify the name of a column followed by an operator and a value to filter on. The value must be in quotation marks. For example:
"LastName = 'Smith'"
See the Expression property of the DataColumn class for more information.
"
See DataColumn.Expression Property
[^]
|
|
|
|
|
Thanks
|
|
|
|
|
How do I make a MVC project appear properly in Visual Studio? I understand the logic of this sort of structure. I have seen some blogs and explanations and even code segments explaining how a program can use MVC. But I want to know what is a good way to represent a Model-View-Controller program in the Visual Studio.
For example, in an ASP.NET program, the asp.net file is associated with a C# file. THey have the same name and, in the Solution Explorer window of the Visual Studio development environment, they are shown linked together where one is a tree branch of the other. Should the same sort of thing be done for a MVC solution? I can remember a few years ago, I worked on a MVVM project, and a developer who first put the solution file together actually had view and the view-model files arranged like this. In order to make this happen, he had to download some sort of patch that allowed him to edit the .sln (solution) file.
Is that the way to go for a Model-View-Controller program? Should each be its own workspace in the solution, or should the solution file be edited such that each Model-View-Controller coupling be handled as a tree structure file representation kind of like it is done for an ASP.NET solution?
Here is another question. What is a good template to use in Visual Studio to create an example of a Model-View-Controller program? I tried this route but when I clicked to "get new templates", it did not work:
[url="http://i67.photobucket.com/albums/h292/Athono/Embedded/Capture_02_zps6vn4ri07.png"]http://i67.photobucket.com/albums/h292/Athono/Embedded/Capture_02_zps6vn4ri07.png[/url]
[url="http://i67.photobucket.com/albums/h292/Athono/Embedded/Capture_zpscdczk1b4.png"]http://i67.photobucket.com/albums/h292/Athono/Embedded/Capture_zpscdczk1b4.png[/url]
|
|
|
|
|
Have you tried using ASP.NET MVC ?
«I'm asked why doesn't C# implement feature X all the time. The answer's always the same: because no one ever designed, specified, implemented, tested, documented, shipped that feature. All six of those things are necessary to make a feature happen. They all cost huge amounts of time, effort and money.» Eric Lippert, Microsoft, 2009
|
|
|
|
|
What version of Visual Studio are you using?
Most editions have a MVC project template.
In the Visual Studio "Community Edition", for example, there is a MVC "new project" template under:
Visual C# | Web | Visual Studio 2012 | ASP.NET MVC 4 Web Template
If you're missing a particular template, there is an option in the "new project" dialog where you can "go online and find templates" (and install it); e.g. MVC 3; MVC 5; MVC boilerplate code.
|
|
|
|
|
The C# file that you're talking about contains the back-end code that would run the application itself, so what kind of trouble are you facing from that C# file? Don't you know C# language, then if you're aware of the VB.NET language you can use it to develop your ASP.NET application too. They have the same name just to remove the ambiguity between them, you can change the name, but always remember to change the Controller name in the settings where you set the back-end code each of your View file.
MVC is just an architechture in software programming, which is implemented by ASP.NET team, to allow developers to make use of that architechture while building up ASP.NET applications. You can create a new Web Application, and then select MVC framework and you're done. How would you like to explain the term, it did not work?
You usually build MVC application, not just simply represent the business-logic in the software. Where are you actually stuck? Anyhow, I have written an article based on beginners and their troubles while learning the ASP.NET MVC framework. You can read that article of mine at CodeProject: Understanding ASP.NET MVC using real world example, for beginners and intermediate[^]. Chances are that you will understand the framework and how to build basic applications. After that you would continue building complex applications. Please do give that article a read, it would help you out in learning the ASP.NET MVC framework.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
|
hi i have a bitmap and a set of points which represent an convex hull, does anyone know how to cut the image out?
|
|
|
|
|
Hello !
I'm using the information from this MSDN blog :
http://blogs.msdn.com/b/mattwar/archive/2007/08/01/linq-building-an-iqueryable-provider-part-iii.aspx[^]
to translate local variable references in linq queries.
Everything works very well except the case when I have a DateTime variable inside the query that I have to translate .
This is my case :
On my database I have the table orders where dt column have Date Type and store only the date.
Now if I have this query :
DateTime dt1 = Convert.ToDateTime("01/01/2012");
var query = db.Orders.Where(c => c.dt == dt1);
If I try to translate , the returned expression is :
SELECT * FROM (SELECT * FROM Orders) AS T WHERE (dt = '01/01/2012 12:00:00
AM')
As you can see the translated query contains the time at the end , and my query everytime return no records.
What can I do that in translated query the value to be only the date without the time.?
I try many variants , I format the variable only to date format , but it's the same thing.
Thank you !
|
|
|
|
|
Try:
var query = db.Orders.Where( c => c.dt.Date == dt1.Date);
This should effectively cause the times to be the same for both dates.
|
|
|
|
|
Doesn't work.
The problem is that however the query is formatted , the return translated query will be :
SELECT * FROM (SELECT * FROM Orders) AS T WHERE (dt = '01/01/2012 12:00:00
AM')
and so the dt column from database is already a date type and only hold the date .
The problem is not how the query is formatted , but how is translated with the methods from the link I posted.It seems that a datetime value (even formatted with only the date part , is translated to Date + Default time "12.00.00".
So what modifications should made on the code at the link that I posted in order to modify only for date types.
|
|
|
|
|
var query = db.Orders.
Where( c => c.dt.Year == dt1.Year && c.dt.Month == dt1.Month && c.dt.Day == dt1.Day );
The Year, Month and Day properties should translate to SQL DATEPART() functions.
(It does in LINQPad).
|
|
|
|
|
dilkonika wrote: What can I do that in translated query the value to be only the date without the time.? There is no point in time that can be defined without time. The DateTime object is a decimal; the integer part holds the days, the fractional part holds the time.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|